我需要在我的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 echo "and" | android update sdk --no-ui --all - filter tools, platform-tools, build-tools- $ BUILD_TOOLS_VERSION> step1.log应该可以解决这个问题。 有人可以告诉我脚本中缺少什么来成功执行编译。

谢谢!!!

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐