我在android项目的circleci上有以下构建失败:
- 出了什么问题: 配置项目':app'时出现问题。 您尚未接受以下SDK组件的许可协议: [求解器为ConstraintLayout 1.0.0-beta4,ConstraintLayout为Android 1.0.0-beta4]。 在构建项目之前,您需要接受许可协议并使用Android Studio SDK Manager完成缺少的组件的安装。 或者,要了解如何将许可协议从一个工作站转移到另一个工作站,请转到http://d.android.com/r/studio-ui/export-licenses.html
我正在使用以下circle.yml进行构建:
test:
override:
- (./gradlew assemble):
timeout: 360
dependencies:
pre:
# Android SDK Platform 24
- if [ ! -d "/usr/local/android-sdk-linux/platforms/android-25" ]; then echo y | android update sdk --no-ui --all --filter "android-25"; fi
# Android SDK Build-tools, revision 25.0.1
- if [ ! -d "/usr/local/android-sdk-linux/build-tools/25.0.1" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-25.0.1"; fi
# Android Support Repository, revision 40 / Local Maven repository for Support Libraries
- if [ ! -d "/usr/local/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/25.0.1" ]; then echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"; fi
# Google Support Repository, revision 40 / Local Maven repository for Support Libraries
- if [ ! -d "/usr/local/android-sdk-linux/extras/google/m2repository/com/google/firebase/firebase-core/10.0.1" ]; then echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"; fi
- mkdir $ANDROID_HOME/licenses; ls -l $ANDROID_HOME/licenses
- cp --force licenses/* $ANDROID_HOME/licenses; ls -l $ANDROID_HOME/licenses
cache_directories:
- /usr/local/android-sdk-linux/platforms/android-25
- /usr/local/android-sdk-linux/build-tools/25.0.1
- /usr/local/android-sdk-linux/extras/android/m2repository
- /usr/local/android-sdk-linux/extras/google/m2repository
override:
# Adding true flag because of this issue with ConstraintLayout https://code.google.com/p/android/issues/detail?id=212128
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies || true
machine:
java:
version: oraclejdk8
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
这个问题可能是什么原因造成的?
答案 0 :(得分:3)
似乎android
已被弃用或被sdkmanager
替换为包管理器。例如,在我的情况下,sdkmanager
可以访问(列出)ConstraintLayout和ConstraintLayout Solver包,但android
没有。
有关sdkmanager
的更多信息,请访问the official docs
就我而言,我还必须使用android
更新sdk工具才能安装sdkmanager
。但是,安装位置不在tools
文件夹中,而是tools/bin
,因此我还必须直接访问sdkmanager
,因为它不包含在$PATH
中在我的CI机器上。
将所有这些应用于您的案例:
# Android SDK Platform 24
- if [ ! -d "/usr/local/android-sdk-linux/platforms/android-25" ]; then echo y | android update sdk --no-ui --all --filter "android-25"; fi
# Android SDK Build-tools, revision 25.0.1
- if [ ! -d "/usr/local/android-sdk-linux/build-tools/25.0.1" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-25.0.1"; fi
# Android Support Repository, revision 40 / Local Maven repository for Support Libraries
- if [ ! -d "/usr/local/android-sdk-linux/extras/android/m2repository/com/android/support/support-v4/25.0.1" ]; then echo y | android update sdk --no-ui --all --filter "extra-android-m2repository"; fi
# Google Support Repository, revision 40 / Local Maven repository for Support Libraries
- if [ ! -d "/usr/local/android-sdk-linux/extras/google/m2repository/com/google/firebase/firebase-core/10.0.1" ]; then echo y | android update sdk --no-ui --all --filter "extra-google-m2repository"; fi
# Android Tools latest (has sdkmanager)
- if [ ! -d "/usr/local/android-sdk-linux/tools/bin/sdkmanager" ]; then echo y | android update sdk --no-ui --all --filter "tools"; fi
# ConstraintLayout
- if [ ! -d "/usr/local/android-sdk-linux/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-beta4" ]; then echo y | /usr/local/android-sdk-linux/tools/bin/sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0-beta4"; fi
# ConstraintLayout Solver
- if [ ! -d "/usr/local/android-sdk-linux/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-beta4" ]; then echo y | /usr/local/android-sdk-linux/tools/bin/sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.0-beta4"; fi