无法安装以下 Android 个 SDK 包,因为某些许可证尚未被接受

Failed to install the following Android SDK packages as some licences have not been accepted

我需要在我的 Android 项目中集成一个持续集成系统,我发现 CodeShip 是一个很好的选择,所以我创建并配置了一个项目来编译我的 Android 应用程序以下脚本:

# Install java 8
jdk_switcher home oraclejdk8
jdk_switcher use oraclejdk8
export JAVA8_HOME=/usr/lib/jvm/java-8-oracle
export BUILD_TOOLS_VERSION=23.0.3
export ANDROID_SDK=24
export ANDROID_SDK_REV=24.4.1
#
# Install android sdk
export SDK_TAR=android-sdk_r$ANDROID_SDK_REV-linux
wget "http://dl.google.com/android/$SDK_TAR.tgz"
tar xvzf "$SDK_TAR.tgz"
rm "$SDK_TAR.tgz"
export ANDROID_HOME=$PWD/android-sdk-linux
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
(while sleep 3; do echo "y"; done) | $ANDROID_HOME/tools/android update sdk -u
echo "y" | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-$BUILD_TOOLS_VERSION > step1.log
echo "y" | android update sdk --no-ui --all --filter extra-android-m2repository,extra-android-support,extra-google-analytics_sdk_v2,extra-google-google_play_services_froyo,extra-google-google_play_services,extra-google-m2repository > step2.log
echo "y" | android update sdk --no-ui --all --filter android-$ANDROID_SDK,sysimg-$ANDROID_SDK,addon-google_apis-google-$ANDROID_SDK > step3.log
#
# Setup gradle
touch local.properties
echo "sdk.dir=$ANDROID_HOME" >> local.properties
chmod u+x ./gradlew
#
# Build
./gradlew assembleDevelop

当我推送我的存储库并启动编译时,编译期间出现以下错误:

Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
FAILURE: Build failed with an exception.
 occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
build-tools;27.0.3 Android SDK Build-Tools 27.0.3
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

Using Android SDK: /home/rof/clone/android-sdk-linux

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s

原则上echo "and" | android update sdk --no-ui --all - filter tools, platform-tools, build-tools- $ BUILD_TOOLS_VERSION> step1.log行应该可以解决这个问题。有人可以告诉我我的脚本中缺少什么才能成功执行编译。

谢谢!!!

您的基础架构提供商(即 CodeShip)不支持该级别的 SDK 构建工具。也许与他们联系可能会有所帮助。

至于在自己的 PC 上工作时出现 Android 错误的人:-

将目录更改为 C:\Users\YOURPCNAME\tools\bin 在这里 运行 sdkmanager --licenses 接受许可证,你就可以开始了