CircleCI Android constraintLayout 不起作用
CircleCI Android constraintLayout doesn't work
我现在正在为我的项目使用 CircleCI。此外,我正在我的项目中实施新的 constraintLayout。现在我被 CircleCI 大楼困住了。当 gradle -dependencies 运行:
File /home/ubuntu/.android/repositories.cfg could not be loaded.
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:
[com.android.support.constraint:constraint-layout:1.0.0-alpha3, com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3].
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
这是我在 .yml 文件中的配置:
#Install android build tools, platforms
#Supported versions here https://circleci.com/docs/android
machine:
java:
version: openjdk8
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
dependencies:
pre:
- echo y | android list sdk
- echo y | android update sdk --no-ui --all --filter "tools"
- echo y | android update sdk --no-ui --all --filter "platform-tools"
- echo y | android update sdk --no-ui --all --filter "build-tools-24.0.0"
- echo y | android update sdk --no-ui --all --filter "android-24"
- echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"
- echo y | android update sdk --no-ui --all --filter "extra-google-google_play_services"
- echo y | android update sdk --no-ui --all --filter "extra-android-support"
- echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
- (./gradlew -version):
timeout: 360
override:
#- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
- export TERM="dumb"; if [ -e ./gradlew ]; then ./gradlew clean dependencies -stacktrace;else gradle clean dependencies -stacktrace;fi
#Pull any submodules
checkout:
post:
- git submodule init
- git submodule update
#-PdisablePreDex is a must else gradle just dies due to memory limit
#Replace
test:
override:
- (./gradlew assemble -PdisablePreDex):
timeout: 360
- cp -r ${HOME}/${CIRCLE_PROJECT_REPONAME}/app/build/outputs/apk/ $CIRCLE_ARTIFACTS
- emulator -avd circleci-android22 -no-audio -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
# run tests against the emulator.
- ./gradlew connectedAndroidTest
#Deploy when tests pass
deployment:
#production:
# branch: master
# commands:
# - (./gradlew clean assembleRelease crashlyticsUploadDistributionRelease -PdisablePreFex):
# timeout: 720
staging:
branch: staging
commands:
- (./gradlew clean assembleStaging crashlyticsUploadDistributionStaging -PdisablePreFex):
timeout: 720
我在
时检查了构建日志
echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
命令 运行 结果如下:
November 20, 2015
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]:
Installing Archives:
Preparing to install archives
Downloading Android Support Repository, revision 33
Installing Android Support Repository, revision 33
Installed Android Support Repository, revision 33
Done. 1 package installed.
我的类路径是:
classpath 'com.android.tools.build:gradle:2.2.0-alpha4'
我不确定自己哪里做错了,或者有什么我需要补充的。请建议。
谢谢。
TL;DR
您需要将许可证从 $ANDROID_HOME/licenses
复制到您的 CircleCI 环境中。
您可以压缩您的许可证并将其存储在 Dropbox(或类似的东西)上,然后修改您的 circle.yml
文件以下载许可证并将其解压缩到 $ANDROID_HOME
。
错误的最后一段几乎解释了它
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
这对我有用,而且还首先检查缓存版本:
dependencies:
pre:
# Android SDK Platform 24
- if [ ! -d "/usr/local/android-sdk-linux/platforms/android-24" ]; then echo y | android update sdk --no-ui --all --filter "android-24"; fi
# Android SDK Build-tools, revision 24.0.1
- if [ ! -d "/usr/local/android-sdk-linux/build-tools/24.0.1" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-24.0.1"; fi
# Android Support Repository, revision 35 / Local Maven repository for Support Libraries
- if [ ! -d "/usr/local/android-sdk-linux/extras/android/m2repository/com/android/support/design/24.1.0" ]; then echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"; fi
cache_directories:
- /usr/local/android-sdk-linux/platforms/android-24
- /usr/local/android-sdk-linux/build-tools/24.0.1
- /usr/local/android-sdk-linux/extras/android/m2repository
取自 this post 由 CircleCI 员工 drazisil
我和 ConstraintLayout
有同样的问题,这是我的工作配置 circle.yml
Alex Fu 的回答很好地解释了问题出在哪里以及如何处理它,但还有一个更简单的解决方案。由于许可证文件实际上只是带有一堆十六进制字符的简单文件,因此您无需任何复制即可轻松创建它们。一个示例是将以下代码放入 pre:
部分:
- ANDROID_HOME=/usr/local/android-sdk-linux
- mkdir "$ANDROID_HOME/licenses" || true
- echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo "84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- echo "d975f751698a77b662f1254ddbeed3901e976f5a" > "$ANDROID_HOME/licenses/intel-android-extra-license"
我现在正在为我的项目使用 CircleCI。此外,我正在我的项目中实施新的 constraintLayout。现在我被 CircleCI 大楼困住了。当 gradle -dependencies 运行:
File /home/ubuntu/.android/repositories.cfg could not be loaded.
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:
[com.android.support.constraint:constraint-layout:1.0.0-alpha3, com.android.support.constraint:constraint-layout-solver:1.0.0-alpha3].
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
这是我在 .yml 文件中的配置:
#Install android build tools, platforms
#Supported versions here https://circleci.com/docs/android
machine:
java:
version: openjdk8
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
dependencies:
pre:
- echo y | android list sdk
- echo y | android update sdk --no-ui --all --filter "tools"
- echo y | android update sdk --no-ui --all --filter "platform-tools"
- echo y | android update sdk --no-ui --all --filter "build-tools-24.0.0"
- echo y | android update sdk --no-ui --all --filter "android-24"
- echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"
- echo y | android update sdk --no-ui --all --filter "extra-google-google_play_services"
- echo y | android update sdk --no-ui --all --filter "extra-android-support"
- echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
- (./gradlew -version):
timeout: 360
override:
#- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies
- export TERM="dumb"; if [ -e ./gradlew ]; then ./gradlew clean dependencies -stacktrace;else gradle clean dependencies -stacktrace;fi
#Pull any submodules
checkout:
post:
- git submodule init
- git submodule update
#-PdisablePreDex is a must else gradle just dies due to memory limit
#Replace
test:
override:
- (./gradlew assemble -PdisablePreDex):
timeout: 360
- cp -r ${HOME}/${CIRCLE_PROJECT_REPONAME}/app/build/outputs/apk/ $CIRCLE_ARTIFACTS
- emulator -avd circleci-android22 -no-audio -no-window:
background: true
parallel: true
# wait for it to have booted
- circle-android wait-for-boot
# run tests against the emulator.
- ./gradlew connectedAndroidTest
#Deploy when tests pass
deployment:
#production:
# branch: master
# commands:
# - (./gradlew clean assembleRelease crashlyticsUploadDistributionRelease -PdisablePreFex):
# timeout: 720
staging:
branch: staging
commands:
- (./gradlew clean assembleStaging crashlyticsUploadDistributionStaging -PdisablePreFex):
timeout: 720
我在
时检查了构建日志echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"
命令 运行 结果如下:
November 20, 2015
Do you accept the license 'android-sdk-license-c81a61d9' [y/n]:
Installing Archives:
Preparing to install archives
Downloading Android Support Repository, revision 33
Installing Android Support Repository, revision 33
Installed Android Support Repository, revision 33
Done. 1 package installed.
我的类路径是:
classpath 'com.android.tools.build:gradle:2.2.0-alpha4'
我不确定自己哪里做错了,或者有什么我需要补充的。请建议。 谢谢。
TL;DR
您需要将许可证从 $ANDROID_HOME/licenses
复制到您的 CircleCI 环境中。
您可以压缩您的许可证并将其存储在 Dropbox(或类似的东西)上,然后修改您的 circle.yml
文件以下载许可证并将其解压缩到 $ANDROID_HOME
。
错误的最后一段几乎解释了它
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
这对我有用,而且还首先检查缓存版本:
dependencies: pre: # Android SDK Platform 24 - if [ ! -d "/usr/local/android-sdk-linux/platforms/android-24" ]; then echo y | android update sdk --no-ui --all --filter "android-24"; fi # Android SDK Build-tools, revision 24.0.1 - if [ ! -d "/usr/local/android-sdk-linux/build-tools/24.0.1" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-24.0.1"; fi # Android Support Repository, revision 35 / Local Maven repository for Support Libraries - if [ ! -d "/usr/local/android-sdk-linux/extras/android/m2repository/com/android/support/design/24.1.0" ]; then echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"; fi cache_directories: - /usr/local/android-sdk-linux/platforms/android-24 - /usr/local/android-sdk-linux/build-tools/24.0.1 - /usr/local/android-sdk-linux/extras/android/m2repository
取自 this post 由 CircleCI 员工 drazisil
我和 ConstraintLayout
有同样的问题,这是我的工作配置 circle.yml
Alex Fu 的回答很好地解释了问题出在哪里以及如何处理它,但还有一个更简单的解决方案。由于许可证文件实际上只是带有一堆十六进制字符的简单文件,因此您无需任何复制即可轻松创建它们。一个示例是将以下代码放入 pre:
部分:
- ANDROID_HOME=/usr/local/android-sdk-linux
- mkdir "$ANDROID_HOME/licenses" || true
- echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo "84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- echo "d975f751698a77b662f1254ddbeed3901e976f5a" > "$ANDROID_HOME/licenses/intel-android-extra-license"