Execute failed: java.io.IOException: Cannot run program "sdk-linux/build-tools/22.0.0/aapt": error=


http://blog.csdn.net/catoop/article/details/47170901

http://blog.csdn.net/catoop/article/details/47170901

http://blog.csdn.net/catoop/article/details/47170901




 

Execute failed: java.io.IOException: Cannot run program "sdk-linux/build-tools/22.0.0/aapt": error=2

  3262人阅读  评论(3)  收藏  举报
  分类:
 
在Linux上使用ant编译打包apk的时候,出现下面的错误及解决方法:

1、/usr/local/android-sdk-linux/tools/ant/build.xml:698: Execute failed: java.io.IOException: Cannot run program "/usr/local/android-sdk-linux/build-tools/22.0.0/aapt": error=2, No such file or directory
 
 
  
  
[html] view plain copy
  1. BUILD FAILED  
  2. /svcroot/workspace/build/MobileAppAndorid/build.xml:94: The following error occurred while executing this line:  
  3. /usr/local/android-sdk-linux/tools/ant/build.xml:653: The following error occurred while executing this line:  
  4. /usr/local/android-sdk-linux/tools/ant/build.xml:698: Execute failed: java.io.IOException: Cannot run program "/usr/local/android-sdk-linux/build-tools/22.0.0/aapt": error=2, No such file or directory  
  5.     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)  
  6.     at java.lang.Runtime.exec(Runtime.java:617)  
  7.     at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)  
  8.     at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)  
  9.     at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)  
  10.     at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)  
  11.     at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)  
  12.     at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)  
  13.     at com.android.ant.AaptExecTask.execute(AaptExecTask.java:699)  
  14.     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)  
  15.     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)  
  16.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  17.     at java.lang.reflect.Method.invoke(Method.java:606)  
  18.     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)  
  19.     at org.apache.tools.ant.Task.perform(Task.java:348)  
  20.     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)  
  21.     at com.android.ant.IfElseTask.execute(IfElseTask.java:120)  
  22.     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)  
  23.     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)  
  24.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  25.     at java.lang.reflect.Method.invoke(Method.java:606)  
  26.     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)  
  27.     at org.apache.tools.ant.Task.perform(Task.java:348)  
  28.     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)  
  29.     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)  
  30.     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)  
  31.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  32.     at java.lang.reflect.Method.invoke(Method.java:606)  
  33.     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)  
  34.     at org.apache.tools.ant.Task.perform(Task.java:348)  
  35.     at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)  
  36.     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)  
  37.     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)  
  38.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  39.     at java.lang.reflect.Method.invoke(Method.java:606)  
  40.     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)  
  41.     at org.apache.tools.ant.Task.perform(Task.java:348)  
  42.     at org.apache.tools.ant.Target.execute(Target.java:435)  
  43.     at org.apache.tools.ant.Target.performTasks(Target.java:456)  
  44.     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)  
  45.     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)  
  46.     at org.apache.tools.ant.Project.executeTargets(Project.java:1248)  
  47.     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)  
  48.     at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)  
  49.     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)  
  50.     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)  
  51.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
  52.     at java.lang.reflect.Method.invoke(Method.java:606)  
  53.     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)  
  54.     at org.apache.tools.ant.Task.perform(Task.java:348)  
  55.     at org.apache.tools.ant.Target.execute(Target.java:435)  
  56.     at org.apache.tools.ant.Target.performTasks(Target.java:456)  
  57.     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)  
  58.     at org.apache.tools.ant.Project.executeTarget(Project.java:1364)  
  59.     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)  
  60.     at org.apache.tools.ant.Project.executeTargets(Project.java:1248)  
  61.     at org.apache.tools.ant.Main.runBuild(Main.java:851)  
  62.     at org.apache.tools.ant.Main.startAnt(Main.java:235)  
  63.     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)  
  64.     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)  
  65. Caused by: java.io.IOException: error=2, No such file or directory  
  66.     at java.lang.UNIXProcess.forkAndExec(Native Method)  
  67.     at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)  
  68.     at java.lang.ProcessImpl.start(ProcessImpl.java:130)  
  69.     at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)  
  70.     ... 59 more  

原因:在64位Linux下打包成APK时缺少x86下C++语言库。

解决: 
# yum install -y compat-libstdc++-296.i686 
# yum install -y compat-libstdc++-33.i686
 
 
2、/usr/local/android-sdk-linux/build-tools/20.0.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
 
 
  
  
[html] view plain copy
  1. -code-gen:  
  2. [mergemanifest] Found modified input file  
  3. [mergemanifest] Merging AndroidManifest files into one.  
  4. [mergemanifest] Manifest merger disabled. Using project manifest only.  
  5.      [echo] Handling aidl files...  
  6.      [aidl] No AIDL files to compile.  
  7.      [echo] ----------  
  8.      [echo] Handling RenderScript files...  
  9.      [echo] ----------  
  10.      [echo] Handling Resources...  
  11.      [aapt] Generating resource IDs...  
  12.      [aapt] /usr/local/android-sdk-linux/build-tools/20.0.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory  
  13.   
  14. BUILD FAILED  
  15. /svcroot/workspace/build-app/MobileAppAndorid/build.xml:94: The following error occurred while executing this line:  
  16. /usr/local/android-sdk-linux/tools/ant/build.xml:653: The following error occurred while executing this line:  
  17. /usr/local/android-sdk-linux/tools/ant/build.xml:698: null returned: 127  
解决: 
# yum install -y zlib

(yum配置可以参考帖子 http://blog.csdn.net/catoop/article/details/41345471 我用的是RHEL 6.5版本的Linux)


3、[aapt] /android/sdk/build-tools/android-4.4/aapt: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory 

  
  
[html] view plain copy
  1. -code-gen:   
  2. [mergemanifest] Merging AndroidManifest files into one.   
  3. [mergemanifest] Manifest merger disabled. Using project manifest only.   
  4.      [echo] Handling aidl files...   
  5.      [aidl] No AIDL files to compile.   
  6.      [echo] ----------   
  7.      [echo] Handling RenderScript files...   
  8.      [echo] ----------   
  9.      [echo] Handling Resources...   
  10.      [aapt] Generating resource IDs...   
  11.      [aapt] /android/sdk/build-tools/android-4.4/aapt: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory   
原因:在64位Linux下打包成APK时缺少x86下C++语言库。 解决:  # yum install -y libstdc++.so.6
 
 
如果2、3的问题还没有解决,使用下面的命令试试:
# yum install glibc*.i686
# yum install zlib*.i686
# yum install libstdc++.so.6



如果在执行 yum install libstdc++.so.6 的时候出现如下错误:

  
  
[html] view plain copy
  1. Error:  Multilib version problems found. This often means that the root  
  2.        cause is something else and multilib version checking is just  
  3.        pointing out that there is a problem. Eg.:  
  4.          
  5.          1. You have an upgrade for libstdc++ which is missing some  
  6.             dependency that another package requires. Yum is trying to  
  7.             solve this by installing an older version of libstdc++ of the  
  8.             different architecture. If you exclude the bad architecture  
  9.             yum will tell you what the root cause is (which package  
  10.             requires what). You can try redoing the upgrade with  
  11.             --exclude libstdc++.otherarch ... this should give you an error  
  12.             message showing the root cause of the problem.  
  13.          
  14.          2. You have multiple architectures of libstdc++ installed, but  
  15.             yum can only see an upgrade for one of those arcitectures.  
  16.             If you don't want/need both architectures anymore then you  
  17.             can remove the one with the missing update and everything  
  18.             will work.  
  19.          
  20.          3. You have duplicate versions of libstdc++ installed already.  
  21.             You can use "yum check" to get yum show these errors.  
  22.          
  23.        ...you can also use --setopt=protected_multilib=false to remove  
  24.        this checking, however this is almost never the correct thing to  
  25.        do as something else is very likely to go wrong (often causing  
  26.        much more problems).  
  27.          
  28.        Protected multilib versions: libstdc++-4.4.7-11.el6.i686 != libstdc++-4.4.7-4.el6.x86_64  

解决办法:yum update libstdc++-4.4.7-4.el6.x86_64

然后再执行:yum install libstdc++.so.6 


---------------

(完)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值