【我的Android进阶之旅】解决Center OS 64位系统编译Android APP报错error=2和finished with non-zero exit value 127

简介: 一、错误描述1、问题 java.io.IOException: error=2, 没有那个文件或目录 今天在刚重新搭建好的64位的Center OS上安装好了Android SDK,Jenkins,Git等一系列用于持续集成的环境之后,准备编译下项目试一试,然后Jenkins编译失败,错误如下所示:Caused by: java.

一、错误描述

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://stackoverflow.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

这里写图片描述

进入链接:
https://stackoverflow.com/questions/11471722/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 directorylibstdc++.so.6库找不到,

一次是因为error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directorylibz.so.1库找不到。

三、参考链接


这里写图片描述

作者:欧阳鹏 欢迎转载,与人分享是进步的源泉!
转载请保留原文地址:http://blog.csdn.net/ouyang_peng/article/details/75146841

如果本文对您有所帮助,欢迎您扫码下图所示的支付宝和微信支付二维码对本文进行打赏。
这里写图片描述

相关文章
|
2月前
|
JSON 小程序 JavaScript
uni-app开发微信小程序的报错[渲染层错误]排查及解决
uni-app开发微信小程序的报错[渲染层错误]排查及解决
550 7
|
2月前
|
缓存 Java Shell
Android 系统缓存扫描与清理方法分析
Android 系统缓存从原理探索到实现。
56 15
Android 系统缓存扫描与清理方法分析
|
22天前
|
算法 JavaScript Android开发
|
24天前
|
安全 搜索推荐 Android开发
揭秘安卓与iOS系统的差异:技术深度对比
【10月更文挑战第27天】 本文深入探讨了安卓(Android)与iOS两大移动操作系统的技术特点和用户体验差异。通过对比两者的系统架构、应用生态、用户界面、安全性等方面,揭示了为何这两种系统能够在市场中各占一席之地,并为用户提供不同的选择。文章旨在为读者提供一个全面的视角,理解两种系统的优势与局限,从而更好地根据自己的需求做出选择。
63 2
|
26天前
|
C#
【Azure App Service】使用Microsoft.Office.Interop.Word来操作Word文档,部署到App Service后报错COMException
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
|
2月前
|
安全 搜索推荐 Android开发
深入探索安卓与iOS系统的差异及其对用户体验的影响
在当今的智能手机市场中,安卓和iOS是两大主流操作系统。它们各自拥有独特的特性和优势,为用户提供了不同的使用体验。本文将深入探讨安卓与iOS系统之间的主要差异,包括它们的设计理念、用户界面、应用生态以及安全性等方面,并分析这些差异如何影响用户的使用体验。
|
2月前
|
安全 搜索推荐 Android开发
揭秘iOS与Android系统的差异:一场技术与哲学的较量
在当今数字化时代,智能手机操作系统的选择成为了用户个性化表达和技术偏好的重要标志。iOS和Android,作为市场上两大主流操作系统,它们之间的竞争不仅仅是技术的比拼,更是设计理念、用户体验和生态系统构建的全面较量。本文将深入探讨iOS与Android在系统架构、应用生态、用户界面及安全性等方面的本质区别,揭示这两种系统背后的哲学思想和市场策略,帮助读者更全面地理解两者的优劣,从而做出更适合自己的选择。
|
23天前
|
安全 搜索推荐 程序员
深入探索Android系统的碎片化问题及其解决方案
在移动操作系统的世界中,Android以其开放性和灵活性赢得了广泛的市场份额。然而,这种开放性也带来了一个众所周知的问题——系统碎片化。本文旨在探讨Android系统碎片化的现状、成因以及可能的解决方案,为开发者和用户提供一种全新的视角来理解这一现象。通过分析不同版本的Android系统分布、硬件多样性以及更新机制的影响,我们提出了一系列针对性的策略,旨在减少碎片化带来的影响,提升用户体验。
|
23天前
|
安全 Android开发 iOS开发
深入探索iOS与Android系统的差异性及优化策略
在当今数字化时代,移动操作系统的竞争尤为激烈,其中iOS和Android作为市场上的两大巨头,各自拥有庞大的用户基础和独特的技术特点。本文旨在通过对比分析iOS与Android的核心差异,探讨各自的优势与局限,并提出针对性的优化策略,以期为用户提供更优质的使用体验和为开发者提供有价值的参考。
|
25天前
|
安全 Android开发 iOS开发
安卓系统与iOS系统的比较####
【10月更文挑战第26天】 本文将深入探讨安卓(Android)和iOS这两大主流移动操作系统的各自特点、优势与不足。通过对比分析,帮助读者更好地理解两者在用户体验、应用生态、系统安全等方面的差异,从而为消费者在选择智能手机时提供参考依据。无论你是技术爱好者还是普通用户,这篇文章都将为你揭示两大系统背后的故事和技术细节。 ####
40 0

推荐镜像

更多
下一篇
无影云桌面