在我写这个问题之前,我已经搜索了关于这个问题的相同问题,他们确实出口许可证,因为仍然使用alpha版本的约束布局。但是现在android已经发布了稳定版的约束布局。我尝试了很多设置,但仍然失败..
我的最新 .travis.yml
language: android
jdk: oraclejdk8
android:
components:
- platform-tools
- tools # to get the new `repository-11.xml`
- tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943)
- build-tools-25.0.0
- android-25
# Additional components
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
licenses:
- 'android-sdk-preview-license-52d11cd2'
- 'android-sdk-license-.+'
- 'google-gdk-license-.+'
script:
- ./gradlew clean build
这是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.package.my"
minSdkVersion 16
targetSdkVersion 25
versionCode 6
versionName "1.3.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.android.support:design:25.0.0'
compile 'org.sufficientlysecure:html-textview:3.2'
compile 'com.android.support:recyclerview-v7:25.2.0'
}
apply plugin: 'com.google.gms.google-services'
在这个设置中,我得到了这个错误
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
[ConstraintLayout for Android 1.0.1, Solver for ConstraintLayout 1.0.1].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1 mins 55.975 secs
The command "./gradlew clean build" exited with 1.
Done. Your build exited with 1.
有没有使用出口许可证的解决方法的解决方案?
我也有同样的问题,问题是我使用的是旧版本的android构建工具和gradle版本,只需将它们更新到最新版本即可。例如,今天gradle的最新版本是3.3,而build tools的最新版本是2.3.3。我的build.gradle文件如下所示
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
这是前段时间提出的一个问题https://issuetracker.google.com/issues/37102998如果你去最后一个答案,你会发现这个问题已经通过升级gradle版本和构建工具版本得到了解决。
对我来说,最简单的解决方案是将SDK许可证从SDK复制到我的项目中,然后告诉Travis在构建时将它们复制到自身。
在Travis的Github页面上已经有一个关于这个问题的关闭的问题,其中一个提到的解决方案目前肯定是有效的。
解决办法
licenses
文件夹.travis所在层次结构上您自己项目的根目录中。yml
文件为。.travis。yml
的before_install块:
.travis.yml:
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- cp ./licenses/* "$ANDROID_HOME/licenses/"
解决方案的精确链接:https://github.com/travis-ci/travis-ci/issues/6617#issuecomment-369580270
有没有不使用出口许可证的解决方法的解决方案?
可以,您可以使用新的sdkmanager
安装约束库并接受许可证:
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
否则,缺失的组件将被 gradle
检测到并下载而不被接受:
# Show version and download Gradle Wrapper if it's not already cached
- cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew --version
# Clean project and download missing dependencies and components
- cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew clean build
在这种情况下,如下所述,您需要通过解决方法第一次接受许可证。
使用Android API级别22至25的约束布局代码实验室存储库的完整工作示例:
language: android
jdk: oraclejdk8
sudo: required # false for Container-Based Infrastructure, required for Sudo-enabled Infrastructure
before_cache:
- rm -f ${TRAVIS_BUILD_DIR}/gradle/caches/modules-2/modules-2.lock # Avoid to repack it due locks
- rm -f ${TRAVIS_BUILD_DIR}/gradle/caches/3.3/classAnalysis/classAnalysis.lock
- rm -f ${TRAVIS_BUILD_DIR}/gradle/caches/3.3/jarSnapshots/jarSnapshots.lock
cache:
directories:
- ${TRAVIS_BUILD_DIR}/gradle/caches/
- ${TRAVIS_BUILD_DIR}/gradle/wrapper/dists/
notifications:
email: false
android:
components: # Cookbooks version: https://github.com/travis-ci/travis-cookbooks/tree/9c6cd11
- tools # Update preinstalled tools from revision 24.0.2 to 24.4.1
- build-tools-25.0.2 # Match build-tools version used in build.gradle
- platform-tools # Update platform-tools to revision 25.0.3+
- tools # Update tools from revision 24.4.1 to 25.2.5
env:
global:
- DIR=constraint-layout-start # Project directory
- API=25 # Android API level 25 by default
- TAG=google_apis # Google APIs by default, alternatively use default
- ABI=armeabi-v7a # ARM ABI v7a by default
- QEMU_AUDIO_DRV=none # Disable emulator audio to avoid warning
- GRADLE_USER_HOME="${TRAVIS_BUILD_DIR}/gradle" # Change location for Gradle Wrapper and cache
- ANDROID_HOME=/usr/local/android-sdk-24.0.2 # Depends on the cookbooks version used in the VM
- TOOLS=${ANDROID_HOME}/tools # PATH order matters, exists more than one emulator script
- PATH=${ANDROID_HOME}:${ANDROID_HOME}/emulator:${TOOLS}:${TOOLS}/bin:${ANDROID_HOME}/platform-tools:${PATH}
- ADB_INSTALL_TIMEOUT=20 # minutes (2 minutes by default)
matrix:
include: # More Emulator API levels to build in parallel
- env: API=24
- env: API=23
- env: API=22
allow_failures:
- env: API=23
- env: API=22
fast_finish: false
before_install:
- export EMULATOR="system-images;android-${API};${TAG};${ABI}" # Used to install/create emulator
- echo 'count=0' > /home/travis/.android/repositories.cfg # Avoid warning
install:
# List and delete unnecessary components to free space
- sdkmanager --list || true
- sdkmanager --uninstall "system-images;android-15;default;armeabi-v7a"
- sdkmanager --uninstall "system-images;android-16;default;armeabi-v7a"
- sdkmanager --uninstall "system-images;android-17;default;armeabi-v7a"
- sdkmanager --uninstall "system-images;android-18;default;armeabi-v7a"
- sdkmanager --uninstall "system-images;android-19;default;armeabi-v7a"
- sdkmanager --uninstall "system-images;android-21;default;armeabi-v7a"
- sdkmanager --uninstall "extras;google;google_play_services"
- sdkmanager --uninstall "extras;android;support"
- sdkmanager --uninstall "platforms;android-10"
- sdkmanager --uninstall "platforms;android-15"
- sdkmanager --uninstall "platforms;android-16"
- sdkmanager --uninstall "platforms;android-17"
- sdkmanager --uninstall "platforms;android-18"
- sdkmanager --uninstall "platforms;android-19"
- sdkmanager --uninstall "platforms;android-20"
- sdkmanager --uninstall "platforms;android-21"
- sdkmanager --uninstall "build-tools;21.1.2"
# Update sdk tools to latest version and install/update components
- echo yes | sdkmanager "tools"
- echo yes | sdkmanager "platforms;android-25" # Latest platform required by SDK tools
- echo yes | sdkmanager "platforms;android-${API}" # Android platform required by emulator
- echo yes | sdkmanager "extras;android;m2repository"
- echo yes | sdkmanager "extras;google;m2repository"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
- echo yes | sdkmanager "$EMULATOR" # Install emulator system image
# Create and start emulator
- echo no | avdmanager create avd -n acib -k "$EMULATOR" -f --abi "$ABI" --tag "$TAG"
- emulator -avd acib -engine classic -no-window -camera-back none -camera-front none -verbose -qemu -m 512 &
# Start adbd, wait for device connected and show android serial
- adb wait-for-device get-serialno
# Show version and download Gradle Wrapper if it's not already cached
- cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew --version
# Clean project and download missing dependencies and components
- cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew clean build
# Check components status
- sdkmanager --list || true
before_script:
# Wait for emulator fully-booted and disable animations
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0 &
- adb shell settings put global transition_animation_scale 0 &
- adb shell settings put global animator_duration_scale 0 &
- sleep 30
- adb shell input keyevent 82 &
script:
# Run all device checks
- cd ${TRAVIS_BUILD_DIR}/${DIR} && ./gradlew connectedCheck
after_script:
# Show tests and lint results
- cat ${TRAVIS_BUILD_DIR}/${DIR}/*/build/outputs/androidTest-results/connected/*
- cat ${TRAVIS_BUILD_DIR}/${DIR}/*/build/reports/lint-results.xml
另外两个使用< code>sdkmanager和< code>avdmanager但不使用< code >${ DIR } 的示例解决方法:
引用
与Gradle自动下载缺失软件包相关的官方文档
从命令行启动模拟器中解释了新的模拟器选项
avdManager
在这里解释替换android avd
自SDK工具版本25.3.0起
sdkManager
在这里解释也增强了从命令行查看和接受所有许可证
我对Travis ci有点过时了,现在似乎需要额外的工作,所以你最好检查一下:
>
正如tir38所注意到的,Android
工具不再受支持。相反,请使用 sdk管理器
...
打开本主题的问题和解决方法:
在您的 .travis.yml
文件中添加:
before_install:
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
不要忘记接受主android
对象上的所有许可证:
android:
components:
# ...
licenses:
- android-sdk-license-.+
- '.+'
如果您收到“请使用 Android Studio 中的 SDK 管理器安装缺少的组件”错误,则只需使用 sdk 管理器命令行工具安装缺少的组件即可:
echo y | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4"
echo y | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta"
>
本文解释Circle ci和Travis ci的限制布局问题
Android SDK 工具包中提供的有关 SDK 管理器的文档 (25.2.3 )
我不使用默认的Travis-ci脚本来安装Android组件并接受许可证,从这里开始:
# Install and update SDK
function install-and-update-sdk {
# Keep SDK packages up-to-date (only missing suggested updates are installed).
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk -u -t \
${UPDATE_PKGS:-'platform-tools,tools,extra-android-m2repository,extra-google-m2repository'}
# Install or reinstall SDK packages (if empty, all packages are installed).
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | android update sdk -a -u -t \
${INSTALL_PKGS:-'build-tools-23.0.3,android-23'},${TARGET_PKGS:-}
}
如果您这样做,您可以同时接受所有许可证:
# THE SETUP STAGE
# ---------------
# If you comment out this section, Travis CI will install for you the components you define here.
# Check your project requirements and the components included by default on Travis-ci VM images.
# Check required: https://github.com/google/iosched/blob/master/doc/BUILDING.md
# Check defaults: http://docs.travis-ci.com/user/languages/android/#Pre-installed-components
android:
components:
# Check Android SDK tools: http://developer.android.com/tools/sdk/tools-notes.html
# Check Android SDK Platform-tools: http://developer.android.com/tools/revisions/platforms.html
# Comment the lines below if the latest revisions of Android SDK Tools are included by default.
# - tools
# - platform-tools
# ...
licenses:
# Check licenses: http://docs.travis-ci.com/user/languages/android/#Dealing-with-Licenses
# By default Travis will accept all the licenses, but it's also possible to define a white list:
# White list current android-sdk-license revision.
# - 'android-sdk-license-5be876d5'
# White list all android-sdk-license revisions.
# - 'android-sdk-license-.+'
# White list all the licenses.
- '.+'
我在Travis上构建Symfony 3.2项目时遇到了一些问题。下载所有依赖项后,它会给我以下错误消息: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache无法打开输入文件:应用程序/控制台脚本Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::cle
我试图接受Android sdk的所有许可证,通过去目录的sdkManager和做 但我一直在犯这个错误。 我升级了我的java版本,我直接尝试了这个也在一些stackoverflow答案中提到: 但我也犯了同样的错误。 我的java版本是:
我在接受Android SDK构建工具28.0.3的许可时遇到了问题。在Gitlab上运行时会出现。
我没有成功地接受许可证。当我试图运行“C:\Users\Damien\AppData\Local\Android\Sdk\tools\bin\sdkmanager.bat--licenses”来接受许可证时,我出现了以下错误:线程“main”java中出现异常。lang.NoClassDefFoundError:javax/xml/bind/annotation/XmlSchema 问题是什么:我
我已经单独测试了neo4j密码查询,目前遇到了两个问题(我将在另一篇文章中发布第二个py2neo问题)。 我一直在通过手动添加行来更改csv文件,如下所示: 我的关键字csv文件如下所示: 但是,当我试图通过向csv文件追加新数据来创建一个新的title节点时,我遇到了一个约束错误,告诉我节点我刚刚已经存在。 我已经尝试遵循这里找到的答案: Neo4j仅在唯一时加载CSV 我在浏览器环境中测试的当
在MySQL中,我想删除一个表。 我尝试了很多方法,但我总是得到一个错误,即不能删除名为的表。这是我得到的错误: #1217-无法删除或更新父行:外键约束失败 我怎么放下这张桌子?