一、错误描述
1、问题 java.io.IOException: error=2, 没有那个文件或目录
今天在刚重新搭建好的64位的Center OS上安装好了Android SDK,Jenkins,Git等一系列用于持续集成的环境之后,准备编译下项目试一试,然后Jenkins编译失败,错误如下所示:
Caused by: java.io.IOException: Cannot run program "/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt" (in directory "/root/.jenkins/workspace/AP_Git/SecureUnisignon"): error=2, 没有那个文件或目录
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 4 more
Caused by: java.io.IOException: error=2, 没有那个文件或目录
... 5 more
完整的错误日志输出如下所示:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':SecureUnisignon:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':SecureUnisignon:processDebugResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:185)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 57 more
Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:873)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:178)
... 65 more
Caused by: java.util.concurrent.ExecutionException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt''
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:871)
... 66 more
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt''
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:197)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:327)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 2 more
Caused by: java.io.IOException: Cannot run program "/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt" (in directory "/root/.jenkins/workspace/AP_Git/SecureUnisignon"): error=2, 没有那个文件或目录
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 4 more
Caused by: java.io.IOException: error=2, 没有那个文件或目录
... 5 more
BUILD FAILED
Total time: 14.231 secs
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
FTP: Current build result is [FAILURE], not going to run.
Email was triggered for: Failure - Any
Sending email for trigger: Failure - Any
An attempt to send an e-mail to empty list of recipients, ignored.
Finished: FAILURE
2、解决问题 java.io.IOException: error=2, 没有那个文件或目录
查看Center OS 系统的相关属性,使用如下命令:
[root@localhost /]# uname -a
Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
参考链接:https://lists.centos.org/pipermail/centos/2012-January/122428.html
由于是64bit的系统,而Android sdk只有32bit的程序,需要安装ia32-libs,才能使用。
按照如上图所示,执行命令:
yum install glibc.i686
运行结果如下所示:
[root@localhost 22.0.1]# yum install glibc.i686
已加载插件:fastestmirror, langpacks
gitlab_gitlab-ce/x86_64/signature | 836 B 00:00:00
gitlab_gitlab-ce/x86_64/signature | 1.0 kB 00:00:00 !!!
gitlab_gitlab-ce-source/signature | 836 B 00:00:00
gitlab_gitlab-ce-source/signature | 951 B 00:00:00 !!!
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.sohu.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 glibc.i686.0.2.17-157.el7_3.4 将被 安装
--> 正在处理依赖关系 glibc-common = 2.17-157.el7_3.4,它被软件包 glibc-2.17-157.el7_3.4.i686 需要
--> 正在处理依赖关系 libfreebl3.so(NSSRAWHASH_3.12.3),它被软件包 glibc-2.17-157.el7_3.4.i686 需要
--> 正在处理依赖关系 libfreebl3.so,它被软件包 glibc-2.17-157.el7_3.4.i686 需要
--> 正在检查事务
---> 软件包 glibc-common.x86_64.0.2.17-78.el7 将被 升级
--> 正在处理依赖关系 glibc-common = 2.17-78.el7,它被软件包 glibc-2.17-78.el7.x86_64 需要
---> 软件包 glibc-common.x86_64.0.2.17-157.el7_3.4 将被 更新
---> 软件包 nss-softokn-freebl.x86_64.0.3.16.2.3-9.el7 将被 升级
---> 软件包 nss-softokn-freebl.i686.0.3.16.2.3-14.4.el7 将被 安装
---> 软件包 nss-softokn-freebl.x86_64.0.3.16.2.3-14.4.el7 将被 更新
--> 正在检查事务
---> 软件包 glibc.x86_64.0.2.17-78.el7 将被 升级
--> 正在处理依赖关系 glibc = 2.17-78.el7,它被软件包 glibc-devel-2.17-78.el7.x86_64 需要
--> 正在处理依赖关系 glibc = 2.17-78.el7,它被软件包 glibc-headers-2.17-78.el7.x86_64 需要
---> 软件包 glibc.x86_64.0.2.17-157.el7_3.4 将被 更新
--> 正在检查事务
---> 软件包 glibc-devel.x86_64.0.2.17-78.el7 将被 升级
---> 软件包 glibc-devel.x86_64.0.2.17-157.el7_3.4 将被 更新
---> 软件包 glibc-headers.x86_64.0.2.17-78.el7 将被 升级
---> 软件包 glibc-headers.x86_64.0.2.17-157.el7_3.4 将被 更新
--> 解决依赖关系完成
依赖关系解决
=============================================================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================================================
正在安装:
glibc i686 2.17-157.el7_3.4 updates 4.2 M
为依赖而安装:
nss-softokn-freebl i686 3.16.2.3-14.4.el7 base 188 k
为依赖而更新:
glibc x86_64 2.17-157.el7_3.4 updates 3.6 M
glibc-common x86_64 2.17-157.el7_3.4 updates 11 M
glibc-devel x86_64 2.17-157.el7_3.4 updates 1.1 M
glibc-headers x86_64 2.17-157.el7_3.4 updates 669 k
nss-softokn-freebl x86_64 3.16.2.3-14.4.el7 base 204 k
事务概要
=============================================================================================================================================================================================
安装 1 软件包 (+1 依赖软件包)
升级 ( 5 依赖软件包)
总计:21 M
总下载量:4.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): nss-softokn-freebl-3.16.2.3-14.4.el7.i686.rpm | 188 kB 00:00:01
(2/2): glibc-2.17-157.el7_3.4.i686.rpm | 4.2 MB 00:00:13
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 323 kB/s | 4.4 MB 00:00:13
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64 1/12
正在更新 : glibc-2.17-157.el7_3.4.x86_64 2/12
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
正在更新 : glibc-common-2.17-157.el7_3.4.x86_64 3/12
正在更新 : glibc-headers-2.17-157.el7_3.4.x86_64 4/12
正在安装 : nss-softokn-freebl-3.16.2.3-14.4.el7.i686 5/12
正在安装 : glibc-2.17-157.el7_3.4.i686 6/12
正在更新 : glibc-devel-2.17-157.el7_3.4.x86_64 7/12
清理 : glibc-devel-2.17-78.el7.x86_64 8/12
清理 : glibc-headers-2.17-78.el7.x86_64 9/12
清理 : nss-softokn-freebl-3.16.2.3-9.el7.x86_64 10/12
清理 : glibc-2.17-78.el7.x86_64 11/12
清理 : glibc-common-2.17-78.el7.x86_64 12/12
验证中 : glibc-common-2.17-157.el7_3.4.x86_64 1/12
验证中 : glibc-2.17-157.el7_3.4.i686 2/12
验证中 : nss-softokn-freebl-3.16.2.3-14.4.el7.i686 3/12
验证中 : glibc-2.17-157.el7_3.4.x86_64 4/12
验证中 : nss-softokn-freebl-3.16.2.3-14.4.el7.x86_64 5/12
验证中 : glibc-headers-2.17-157.el7_3.4.x86_64 6/12
验证中 : glibc-devel-2.17-157.el7_3.4.x86_64 7/12
验证中 : glibc-2.17-78.el7.x86_64 8/12
验证中 : nss-softokn-freebl-3.16.2.3-9.el7.x86_64 9/12
验证中 : glibc-common-2.17-78.el7.x86_64 10/12
验证中 : glibc-devel-2.17-78.el7.x86_64 11/12
验证中 : glibc-headers-2.17-78.el7.x86_64 12/12
已安装:
glibc.i686 0:2.17-157.el7_3.4
作为依赖被安装:
nss-softokn-freebl.i686 0:3.16.2.3-14.4.el7
作为依赖被升级:
glibc.x86_64 0:2.17-157.el7_3.4 glibc-common.x86_64 0:2.17-157.el7_3.4 glibc-devel.x86_64 0:2.17-157.el7_3.4 glibc-headers.x86_64 0:2.17-157.el7_3.4
nss-softokn-freebl.x86_64 0:3.16.2.3-14.4.el7
完毕!
[root@localhost 22.0.1]#
3、问题 aapt finished with non-zero exit value 127
启动Jenkins重新编译,error=2, 没有那个文件或目录错误不再出现,接着出现了新的错误
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:185)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 57 more
Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:873)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:178)
... 65 more
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt' with arguments {package -f --no-crunch -I /usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/platforms/android-22/android.jar -M /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/intermediates/manifests/aapt/debug/AndroidManifest.xml -S /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/intermediates/bundles/debug/res -m -J /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/generated/source/r/debug --debug-mode --custom-package com.bbk.secureunisignon --non-constant-id -0 apk --output-text-symbols /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/intermediates/bundles/debug}
at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:871)
... 66 more
Caused by: com.android.ide.common.process.ProcessException: Error while executing '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt' with arguments {package -f --no-crunch -I /usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/platforms/android-22/android.jar -M /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/intermediates/manifests/aapt/debug/AndroidManifest.xml -S /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/intermediates/bundles/debug/res -m -J /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/generated/source/r/debug --debug-mode --custom-package com.bbk.secureunisignon --non-constant-id -0 apk --output-text-symbols /root/.jenkins/workspace/AP_Git/SecureUnisignon/build/intermediates/bundles/debug}
at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:75)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:49)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:78)
at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:74)
at com.google.common.util.concurrent.Futures$6.run(Futures.java:1319)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:457)
at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:156)
at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:145)
at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:185)
at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:53)
at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:60)
Caused by: org.gradle.process.internal.ExecException: Process 'command '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 127
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:47)
... 9 more
又执行了以下三行命令,用于安装 lib32stdc++6 、lib32z1、lib32ncurses5
sudo yum install libstdc++*
sudo yum install zlib*
sudo yum install libncurses*
完整执行过程如下所示:
[root@localhost /]# sudo yum install libstdc++*
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 libstdc++.x86_64.0.4.8.3-9.el7 将被 升级
--> 正在处理依赖关系 libstdc++ = 4.8.3-9.el7,它被软件包 gcc-c++-4.8.3-9.el7.x86_64 需要
---> 软件包 libstdc++.x86_64.0.4.8.5-11.el7 将被 更新
---> 软件包 libstdc++-devel.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 libstdc++-devel.x86_64.0.4.8.5-11.el7 将被 更新
---> 软件包 libstdc++-docs.x86_64.0.4.8.5-11.el7 将被 安装
---> 软件包 libstdc++-static.x86_64.0.4.8.5-11.el7 将被 安装
--> 正在检查事务
---> 软件包 gcc-c++.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 gcc-c++.x86_64.0.4.8.5-11.el7 将被 更新
--> 正在处理依赖关系 gcc = 4.8.5-11.el7,它被软件包 gcc-c++-4.8.5-11.el7.x86_64 需要
--> 正在检查事务
---> 软件包 gcc.x86_64.0.4.8.3-9.el7 将被 升级
--> 正在处理依赖关系 gcc = 4.8.3-9.el7,它被软件包 gcc-gfortran-4.8.3-9.el7.x86_64 需要
--> 正在处理依赖关系 gcc = 4.8.3-9.el7,它被软件包 libquadmath-devel-4.8.3-9.el7.x86_64 需要
---> 软件包 gcc.x86_64.0.4.8.5-11.el7 将被 更新
--> 正在处理依赖关系 libgomp = 4.8.5-11.el7,它被软件包 gcc-4.8.5-11.el7.x86_64 需要
--> 正在处理依赖关系 cpp = 4.8.5-11.el7,它被软件包 gcc-4.8.5-11.el7.x86_64 需要
--> 正在检查事务
---> 软件包 cpp.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 cpp.x86_64.0.4.8.5-11.el7 将被 更新
---> 软件包 gcc-gfortran.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 gcc-gfortran.x86_64.0.4.8.5-11.el7 将被 更新
--> 正在处理依赖关系 libquadmath = 4.8.5-11.el7,它被软件包 gcc-gfortran-4.8.5-11.el7.x86_64 需要
--> 正在处理依赖关系 libgfortran = 4.8.5-11.el7,它被软件包 gcc-gfortran-4.8.5-11.el7.x86_64 需要
---> 软件包 libgomp.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 libgomp.x86_64.0.4.8.5-11.el7 将被 更新
---> 软件包 libquadmath-devel.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 libquadmath-devel.x86_64.0.4.8.5-11.el7 将被 更新
--> 正在检查事务
---> 软件包 libgfortran.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 libgfortran.x86_64.0.4.8.5-11.el7 将被 更新
---> 软件包 libquadmath.x86_64.0.4.8.3-9.el7 将被 升级
---> 软件包 libquadmath.x86_64.0.4.8.5-11.el7 将被 更新
--> 解决依赖关系完成
依赖关系解决
=============================================================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================================================
正在安装:
libstdc++-docs x86_64 4.8.5-11.el7 base 11 M
libstdc++-static x86_64 4.8.5-11.el7 base 408 k
正在更新:
libstdc++ x86_64 4.8.5-11.el7 base 300 k
libstdc++-devel x86_64 4.8.5-11.el7 base 1.5 M
为依赖而更新:
cpp x86_64 4.8.5-11.el7 base 5.9 M
gcc x86_64 4.8.5-11.el7 base 16 M
gcc-c++ x86_64 4.8.5-11.el7 base 7.2 M
gcc-gfortran x86_64 4.8.5-11.el7 base 6.6 M
libgfortran x86_64 4.8.5-11.el7 base 295 k
libgomp x86_64 4.8.5-11.el7 base 152 k
libquadmath x86_64 4.8.5-11.el7 base 184 k
libquadmath-devel x86_64 4.8.5-11.el7 base 47 k
事务概要
=============================================================================================================================================================================================
安装 2 软件包
升级 2 软件包 (+8 依赖软件包)
总计:50 M
总下载量:11 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): libstdc++-static-4.8.5-11.el7.x86_64.rpm | 408 kB 00:00:02
(2/2): libstdc++-docs-4.8.5-11.el7.x86_64.rpm | 11 MB 00:00:43
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 271 kB/s | 11 MB 00:00:43
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : libquadmath-4.8.5-11.el7.x86_64 1/22
正在更新 : libstdc++-4.8.5-11.el7.x86_64 2/22
正在更新 : libstdc++-devel-4.8.5-11.el7.x86_64 3/22
正在更新 : libgfortran-4.8.5-11.el7.x86_64 4/22
正在更新 : libgomp-4.8.5-11.el7.x86_64 5/22
正在更新 : cpp-4.8.5-11.el7.x86_64 6/22
正在更新 : gcc-4.8.5-11.el7.x86_64 7/22
正在更新 : libquadmath-devel-4.8.5-11.el7.x86_64 8/22
正在更新 : gcc-gfortran-4.8.5-11.el7.x86_64 9/22
正在更新 : gcc-c++-4.8.5-11.el7.x86_64 10/22
正在安装 : libstdc++-static-4.8.5-11.el7.x86_64 11/22
正在安装 : libstdc++-docs-4.8.5-11.el7.x86_64 12/22
清理 : gcc-gfortran-4.8.3-9.el7.x86_64 13/22
清理 : gcc-c++-4.8.3-9.el7.x86_64 14/22
清理 : libquadmath-devel-4.8.3-9.el7.x86_64 15/22
清理 : libstdc++-devel-4.8.3-9.el7.x86_64 16/22
清理 : gcc-4.8.3-9.el7.x86_64 17/22
清理 : libgfortran-4.8.3-9.el7.x86_64 18/22
清理 : libquadmath-4.8.3-9.el7.x86_64 19/22
清理 : cpp-4.8.3-9.el7.x86_64 20/22
清理 : libgomp-4.8.3-9.el7.x86_64 21/22
清理 : libstdc++-4.8.3-9.el7.x86_64 22/22
验证中 : gcc-c++-4.8.5-11.el7.x86_64 1/22
验证中 : libquadmath-4.8.5-11.el7.x86_64 2/22
验证中 : cpp-4.8.5-11.el7.x86_64 3/22
验证中 : libgfortran-4.8.5-11.el7.x86_64 4/22
验证中 : libquadmath-devel-4.8.5-11.el7.x86_64 5/22
验证中 : libstdc++-docs-4.8.5-11.el7.x86_64 6/22
验证中 : libstdc++-4.8.5-11.el7.x86_64 7/22
验证中 : gcc-gfortran-4.8.5-11.el7.x86_64 8/22
验证中 : libstdc++-devel-4.8.5-11.el7.x86_64 9/22
验证中 : libgomp-4.8.5-11.el7.x86_64 10/22
验证中 : gcc-4.8.5-11.el7.x86_64 11/22
验证中 : libstdc++-static-4.8.5-11.el7.x86_64 12/22
验证中 : libgfortran-4.8.3-9.el7.x86_64 13/22
验证中 : libgomp-4.8.3-9.el7.x86_64 14/22
验证中 : libstdc++-devel-4.8.3-9.el7.x86_64 15/22
验证中 : gcc-gfortran-4.8.3-9.el7.x86_64 16/22
验证中 : libquadmath-devel-4.8.3-9.el7.x86_64 17/22
验证中 : cpp-4.8.3-9.el7.x86_64 18/22
验证中 : gcc-c++-4.8.3-9.el7.x86_64 19/22
验证中 : gcc-4.8.3-9.el7.x86_64 20/22
验证中 : libstdc++-4.8.3-9.el7.x86_64 21/22
验证中 : libquadmath-4.8.3-9.el7.x86_64 22/22
已安装:
libstdc++-docs.x86_64 0:4.8.5-11.el7 libstdc++-static.x86_64 0:4.8.5-11.el7
更新完毕:
libstdc++.x86_64 0:4.8.5-11.el7 libstdc++-devel.x86_64 0:4.8.5-11.el7
作为依赖被升级:
cpp.x86_64 0:4.8.5-11.el7 gcc.x86_64 0:4.8.5-11.el7 gcc-c++.x86_64 0:4.8.5-11.el7 gcc-gfortran.x86_64 0:4.8.5-11.el7 libgfortran.x86_64 0:4.8.5-11.el7
libgomp.x86_64 0:4.8.5-11.el7 libquadmath.x86_64 0:4.8.5-11.el7 libquadmath-devel.x86_64 0:4.8.5-11.el7
完毕!
[root@localhost /]# sudo yum install zlib*
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.sohu.com
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 zlib.x86_64.0.1.2.7-13.el7 将被 升级
---> 软件包 zlib.x86_64.0.1.2.7-17.el7 将被 更新
---> 软件包 zlib-devel.x86_64.0.1.2.7-17.el7 将被 安装
---> 软件包 zlib-static.x86_64.0.1.2.7-17.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=============================================================================================================================================================================================
Package 架构 版本 源 大小
=============================================================================================================================================================================================
正在安装:
zlib-devel x86_64 1.2.7-17.el7 base 50 k
zlib-static x86_64 1.2.7-17.el7 base 58 k
正在更新:
zlib x86_64 1.2.7-17.el7 base 90 k
事务概要
=============================================================================================================================================================================================
安装 2 软件包
升级 1 软件包
总计:198 k
总下载量:108 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): zlib-devel-1.2.7-17.el7.x86_64.rpm | 50 kB 00:00:00
(2/2): zlib-static-1.2.7-17.el7.x86_64.rpm | 58 kB 00:00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 204 kB/s | 108 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : zlib-1.2.7-17.el7.x86_64 1/4
正在安装 : zlib-devel-1.2.7-17.el7.x86_64 2/4
正在安装 : zlib-static-1.2.7-17.el7.x86_64 3/4
清理 : zlib-1.2.7-13.el7.x86_64 4/4
验证中 : zlib-devel-1.2.7-17.el7.x86_64 1/4
验证中 : zlib-static-1.2.7-17.el7.x86_64 2/4
验证中 : zlib-1.2.7-17.el7.x86_64 3/4
验证中 : zlib-1.2.7-13.el7.x86_64 4/4
已安装:
zlib-devel.x86_64 0:1.2.7-17.el7 zlib-static.x86_64 0:1.2.7-17.el7
更新完毕:
zlib.x86_64 0:1.2.7-17.el7
完毕!
[root@localhost /]# sudo yum install libncurses*
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.ustc.edu.cn
* extras: mirrors.sohu.com
* updates: mirrors.aliyun.com
软件包 ncurses-libs-5.9-13.20130511.el7.x86_64 已安装并且是最新版本
无须任何处理
4、解决问题 aapt” finished with non-zero exit value 127,原因 error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
还是编译不行,一直出错,连续执行添加32位库的命令,重试了18次还是不行
然后我把错误日志,继续认认真真的查看了下,发现在错误报告中有这么一条错误:
processDebugResources/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
FAILED
FAILURE: Build failed with an exception.
搜索关键字: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
进入链接:
https://*.com/questions/21256866/libz-so-1-cannot-open-shared-object-file
按照如上图所示的解决方法,执行命令yum install zlib.i686
yum install zlib.i686
5、解决问题 aapt” finished with non-zero exit value 127,原因 error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
重新启动Jenkins,重新编译,还是编译不过,一样的出现finished with non-zero exit value 127
,但是这次的提示是:
processDebugResources/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
搜索关键字:error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
按照上面的提示,执行命令:
sudo yum install libstdc++.i686
sudo yum install libstdc++-devel.i686
然后再重新启动Jenkins,重新编译。然后就编译成功了。
看到BUILD SUCCESSFUL这几个字多么的兴奋啊!
整个过程,不停的尝试了很多命令,最终还是成功了!
二、总结
这次Jenkins编译不过的原因,主要还是因为我的Center OS 服务器是64位的系统,而Android SDK只有32位的程序,需要安装32位相关的lib才能使用。然后一个一个lib的添加,直到能够成功编译为止。在编译失败的过程中,要认真分析到底哪里失败了,有时候Jenkins失败的表现是一样的,但是实际上失败的原因是不同的。
比如上面两次编译一直报Caused by: org.gradle.process.internal.ExecException: Process 'command '/usr/local/share/adt-bundle-linux-x86_64-20140702/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 127
,但是两次失败的原因不同,
一次是因为error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
libstdc++.so.6库找不到,
一次是因为error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
libz.so.1库找不到。
三、参考链接
- https://lists.centos.org/pipermail/centos/2012-January/122428.html
- https://www.centos.org/forums/viewtopic.php?t=47656
- https://*.com/questions/41330118/aapt-finished-with-non-zero-exit-value-127
- https://*.com/questions/29148282/gradle-build-failed-in-android-studio
- https://*.com/questions/21256866/libz-so-1-cannot-open-shared-object-file
- https://*.com/questions/21256866/libz-so-1-cannot-open-shared-object-file
- https://*.com/questions/11471722/libstdc-so-6-cannot-open-shared-object-file-no-such-file-or-directory
- http://blog.csdn.net/hunterno4/article/details/8920368
- http://blog.csdn.net/whjkm/article/details/43239021
- http://blog.csdn.net/tmy257/article/details/41013985
- http://blog.csdn.net/catoop/article/details/47157631
作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng/article/details/75146841如果本文对您有所帮助,欢迎您扫码下图所示的支付宝和微信支付二维码对本文进行打赏。