chmod + x gradlew ./gradlew干净构建--refresh-dependencies --stacktrace失败

时间:2018-10-03 11:34:58

标签: android jenkins

我正在尝试使用以下方式构建android apk:

jenkins@test-jenkins-vm:/home/lesha$ java --version

openjdk 10.0.2 2018-07-17 OpenJDK Runtime Environment (build
10.0.2+13-Ubuntu-1ubuntu0.18.04.2) OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2, mixed mode)

jenkins@test-jenkins-vm:/home/lesha$ gradle -v

------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------

Build time:   2018-09-19 18:10:15 UTC
Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_181 (Oracle Corporation 25.181-b13)
OS:           Linux 4.15.0-1023-azure amd64

我的android SDK位于

jenkins@test-jenkins-vm:/home/lesha$ cd $ANDROID_HOME
jenkins@test-jenkins-vm:/opt/android-sdk-linux$ ls
NOTICE.txt  bin      emulator    lib       mksdcard  platforms  source.properties  tools
android     build-tools  emulator-check  licenses  monitor   proguard   support

执行时

chmod +x gradlew && ./gradlew clean build --refresh-dependencies --stacktrace

我遇到错误

  

[Gradle]-启动构建。       [Android] $ gradle clean build clean build --refresh-dependencies --stacktrace -b build.gradle

> Configure project :app
Checking the license for package Android SDK Build-Tools 27.0.3 in /opt/android-sdk-linux/licenses
License for package Android SDK Build-Tools 27.0.3 accepted.
Preparing "Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)".
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" ready.
Installing Android SDK Build-Tools 27.0.3 in /opt/android-sdk-linux/build-tools/27.0.3
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" complete.
"Install Android SDK Build-Tools 27.0.3 (revision: 27.0.3)" finished.
Checking the license for package Android SDK Platform 27 in /opt/android-sdk-linux/licenses
License for package Android SDK Platform 27 accepted.
Preparing "Install Android SDK Platform 27 (revision: 3)".
"Install Android SDK Platform 27 (revision: 3)" ready.
Installing Android SDK Platform 27 in /opt/android-sdk-linux/platforms/android-27
"Install Android SDK Platform 27 (revision: 3)" complete.
"Install Android SDK Platform 27 (revision: 3)" finished.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to find target with hash string 'android-27' in: /opt/android-sdk-linux

有人可以帮忙吗?

0 个答案:

没有答案