报错信息
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':MXVideoLib:compileDebugLibraryResources'.
> A failure occurred while executing com.android.build.gradle.tasks.CompileLibraryResourcesTask$CompileLibraryResourcesAction
> There were multiple failures while executing work items
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-7.2.1-7984345-linux Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
> A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-7.2.1-7984345-linux Daemon #1: 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 15s
25 actionable tasks: 24 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
环境配置好之后打包一直报 AAPT2 aapt2-7.2.1-7984345-linux Daemon #1: Daemon startup failed 错误,网上找了好多都是修改 job 目录,还有修改 gradle 缓存目录的,试了都没有用。
之后运行 Run with --info or --debug option to get more log output. 查看具体的报错日志如下:
Caused by: java.io.IOException: Cannot run program "/var/jenkins_home/gradle-cache/caches/transforms-3/56f85ed9554d11d6f2b5cc3775a5be3c/transformed/aapt2-7.2.1-7984345-linux/aapt2": error=2, No such file or directory
at com.android.builder.internal.aapt.v2.Aapt2DaemonImpl.startProcess(Aapt2DaemonImpl.kt:86)
at com.android.builder.internal.aapt.v2.Aapt2Daemon.checkStarted(Aapt2Daemon.kt:56)
... 31 more
Caused by: java.io.IOException: error=2, No such file or directory
... 33 more
* Get more help at https://help.gradle.org
BUILD FAILED in 44s
28 actionable tasks: 8 executed, 20 up-to-date
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
主要信息是 /aapt2": error=2, No such file or directory,去路径下查看是能找到这个文件的。
最后的解决方案是:
sudo docker ps
//复制jenkins docker的 CONTAINER ID
sudo docker exec -it -u root 3b781adce809 /bin/bash\
//3b781adce809 是第一步拿到的id,执行完就进入了alpine系统\
然后运行下面所有命令
apk add --no-cache --update --virtual=.build-dependencies ca-certificates wget\
wget https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -O /etc/apk/keys/sgerrand.rsa.pub\
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk -O /tmp/glibc.apk\
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-bin-2.32-r0.apk -O /tmp/glibc-bin.apk\
apk add --no-cache /tmp/glibc.apk /tmp/glibc-bin.apk
参考链接: