Jenkins Android构建始终会因AAPT2错误而失败

时间:2018-07-17 03:16:57

标签: android jenkins gradle android-gradle aapt2

我最近为在Ubuntu 16.04上运行的Android项目设置了Jenkins构建服务器。我已经将它主要用于将其从GitHub提取并尝试构建项目的地方。由于某种原因,无论何时我将任务设置为运行gradlew buildgradlew assembleDebug时,它总是会因AAPT2错误而失败。我之所以说是因为一个项目给了我一个不同于另一个项目的AAPT2错误。在我的本地Windows计算机上,这两个项目都可以毫无问题地编译。

Jenkins指向位于Jenkins机器上/ opt / android-sdk的最新sdk工具(https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip)。 Jenkins计算机配置了oracle-java-8。

项目1的控制台输出:

[Gradle] - Launching build.
[Test] $ /var/lib/jenkins/workspace/Test/gradlew clean assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
File /var/lib/jenkins/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 27.0.3 in /opt/android-sdk/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/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/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/platforms/android-27
"Install Android SDK Platform 27 (revision: 3)" complete.
"Install Android SDK Platform 27 (revision: 3)" finished.
Checking the license for package Android SDK Platform-Tools in /opt/android-sdk/licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 28.0.0)".
"Install Android SDK Platform-Tools (revision: 28.0.0)" ready.
Installing Android SDK Platform-Tools in /opt/android-sdk/platform-tools
"Install Android SDK Platform-Tools (revision: 28.0.0)" complete.
"Install Android SDK Platform-Tools (revision: 28.0.0)" finished.
:clean
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:mainApkListPersistenceDebug
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResourcesAAPT err(Facade for 27706406): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
AAPT err(Facade for 26922534): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
AAPT err(Facade for 32626108): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
AAPT err(Facade for 26996178): /opt/android-sdk/build-tools/27.0.3/aapt2: 1: /opt/android-sdk/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
Slave 32626108 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
    at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
    at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
    at java.lang.Thread.run(Thread.java:748)
Slave 26922534 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
    at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
    at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
    at java.lang.Thread.run(Thread.java:748)
Slave 27706406 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
    at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
    at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_1" java.util.MissingFormatArgumentException: Format specifier '%1$s'
Slave 26996178 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /opt/android-sdk/build-tools/27.0.3/aapt2) are not corrupted.
    at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
    at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
    at java.lang.Thread.run(Thread.java:748)
    at java.util.Formatter.format(Formatter.java:2525)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_4" java.util.MissingFormatArgumentException: Format specifier '%1$s'
    at java.util.Formatter.format(Formatter.java:2525)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_3" java.util.MissingFormatArgumentException: Format specifier '%1$s'
    at java.util.Formatter.format(Formatter.java:2525)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_2" java.util.MissingFormatArgumentException: Format specifier '%1$s'
    at java.util.Formatter.format(Formatter.java:2525)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
    at java.lang.Thread.run(Thread.java:748)

Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.
:app:createDebugCompatibleScreenManifests
:app:processDebugManifest
:app:splitsDiscoveryTaskDebug
:app:prepareLintJar UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:mergeDebugJniLibFolders
:app:transformNativeLibsWithMergeJniLibsForDebug
:app:processDebugJavaRes NO-SOURCE
:app:validateSigningDebug
:app:mergeDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.

* 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 4m 33s
20 actionable tasks: 19 executed, 1 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE

项目2的控制台输出:

[Gradle] - Launching build.
[ProjectName] $ /var/lib/jenkins/workspace/ProjectName/gradlew clean assembleDebug
Starting a Gradle Daemon (subsequent builds will be faster)
File /var/lib/jenkins/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Platform 28 in /opt/android-sdk/licenses
License for package Android SDK Platform 28 accepted.
Preparing "Install Android SDK Platform 28 (revision: 4)".
"Install Android SDK Platform 28 (revision: 4)" ready.
Installing Android SDK Platform 28 in /opt/android-sdk/platforms/android-28
"Install Android SDK Platform 28 (revision: 4)" complete.
"Install Android SDK Platform 28 (revision: 4)" finished.
:clean UP-TO-DATE
:app:clean
:app:checkDebugClasspath
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl NO-SOURCE
:app:compileDebugRenderscript
:app:checkDebugManifest
:app:generateDebugBuildConfig
:app:generateSafeArgsDebug
:app:prepareLintJar
:app:mainApkListPersistenceDebug
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResourcesAAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #2: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #0: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #1: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #4: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #3: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #5: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #7: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #6: Unexpected error output: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: 19: /var/lib/jenkins/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-beta03-4818971-linux.jar/af6f6047a6877ad6fb27278423eb186d/aapt2-3.2.0-beta03-4818971-linux/aapt2: Syntax error: word unexpected (expecting ")")
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.2.0-beta03-4818971-linux Daemon #2: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.

* 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 3m 27s
12 actionable tasks: 11 executed, 1 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure

我真的不确定为什么会得到这些结果,特别是因为这两个项目在本地Windows计算机上的构建都很好。也许我缺少应该在Jenkins机器上安装的东西?我希望除了在gradle.properties中禁用aapt2之外,还有一个答案,因为它在这里并没有真正找到问题。

0 个答案:

没有答案