Build在我的Mac上运行良好,但在Debian Jenkins服务器上运行不好。只有在运行构建工具24.+时才会发生。我认为这与PNG文件有关,因为它显示Thread(png-cruncher-3): Stream closed
。
我得到以下错误:
:app:mergeDebugResourcesAAPT err(Facade for 1989818655): /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt: 1: /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt: Syntax error: "(" unexpected
然后我陷入了以下无限循环:
Thread(png-cruncher_3): Stream closed
java.io.IOException: Stream closed
at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:433)
at java.io.OutputStream.write(OutputStream.java:116)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:297)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at com.android.builder.png.AaptProcess.shutdown(AaptProcess.java:143)
at com.android.builder.png.QueuedCruncher$1.destruction(QueuedCruncher.java:144)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:245)
at java.lang.Thread.run(Thread.java:745)
我运行的Debian版本是:
Linux f88267848086 4.4.15-moby #1 SMP Thu Jul 28 22:03:07 UTC 2016 x86_64 GNU/Linux
编辑-在@Ashish的回答后添加了更多调试日志
15:29:46.069 [INFO] [org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs] All input files are considered out-of-date for incremental task ':app:mergeDebugResources'.
15:29:46.075 [INFO] [org.gradle.api.Project] Unable do incremental execution: full task run
15:29:49.483 [INFO] [org.gradle.api.Project] QueuedCruncher is using /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt
15:29:49.624 [DEBUG] [org.gradle.api.Project] Trying to start /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt
15:29:49.633 [DEBUG] [org.gradle.api.Project] Trying to start /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt
15:29:49.632 [DEBUG] [org.gradle.api.Project] Trying to start /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt
15:29:49.632 [DEBUG] [org.gradle.api.Project] Trying to start /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt
15:29:49.650 [DEBUG] [org.gradle.api.Project] Thread(pool-3-thread-1): begin waitForAll
15:29:49.639 [DEBUG] [org.gradle.api.Project] Trying to start /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt
15:29:49.690 [DEBUG] [org.gradle.api.Project] Thread(pool-3-thread-1) : wait for {QueuedJob{
title=Cruncher abc_ic_menu_share_mtrl_alpha.png,
task={from=abc_ic_menu_share_mtrl_alpha.png, to=/var/jenkins_home/workspace/MyProject/app/build/intermediates/res/merged/debug/drawable-hdpi-v4/abc_ic_menu_share_mtrl_alpha.png},
latch=BooleanLatch{signaled=false},
result=false})
15:29:50.036 [DEBUG] [org.gradle.api.Project] Started 662662616
15:29:50.044 [DEBUG] [org.gradle.api.Project] Thread(png-cruncher_1): created aapt slave, Process(662662616)
15:29:50.056 [DEBUG] [org.gradle.api.Project] AAPT err(Facade for 2095046102): /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt: 1: /var/jenkins_home/tools/android-sdk/build-tools/24.0.2/aapt: Syntax error: "(" unexpected
Easier thing to do will be to remove that PNG file and then run the build again.
If that narrows down to your PNG idea.
However you can paste the details logs here by running gradle build with -d option.
看看这个https://docs.gradle.org/current/userguide/logging.html