我正在尝试使用 Travis 使用 android-28
和 build-tools-28.0.0
构建 android 项目,但无论我做什么,我都会得到
>Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-28 Android SDK Platform 28
build-tools;28.0.0 Android SDK Build-Tools 28
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
在编译期间。
我试过了:
- 添加:
components: - build-tools-28.0.0 - android-28
- 通过以下方式安装:
echo y | android update sdk --no-ui --filter build-tools-28.0.0,android-28,extra-android-m2repository
- 使用以下方式接受许可:
yes | sudo $ANDROID_HOME/tools/bin/sdkmanager --licenses
- 使用以下方式接受许可:
licenses: - 'android-sdk-preview-license-52d11cd2' - 'android-sdk-license-.+' - 'google-gdk-license-.+'
- 甚至手动写入
$ANDROID_SDK/licenses
内的文件。
我很确定 2 周前它工作完全正常,但现在它每次都抛出这个错误。
PR in question这样您就可以查看错误、构建和文件。
最佳答案
将以下代码添加到您的 .travis.yml
文件中
before_install:
- yes | sdkmanager "platforms;android-28"
或
before_install:
- chmod +x gradlew
- mkdir "$ANDROID_HOME/licenses" || true
- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
- yes | sdkmanager --update
- yes | sdkmanager --licenses
关于android - 特拉维斯-CI `Android 28 licenses have not been accepted`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52274229/