错误:java.io.IOException:在Android设备上构建在任务' processDebugResources'

时间:2016-01-27 12:27:41

标签: cordova meteor ubuntu-12.04 phonegap-build android-build

我使用的是Ubuntu 12.04.4 LTS,我的Android手机是

三星Galaxy S3 Neo I93001 Android版本4.3 并成功连接到设备。

~$ adb devices
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
4e1eb1e1    device

尝试在Android设备中构建示例应用时遇到此错误。

  

任务执行失败':CordovaLib:processDebugResources'。

     

java.io.IOException :无法运行程序   " /android-sdk-linux/build-tools/23.0.2/aapt" ;: error = 2,没有这样的文件或   目录

     

尝试:使用--stacktrace选项运行以获取堆栈跟踪。   使用--info或--debug选项运行以获得更多日志输出。

     

建立失败

~/socially1-3$ meteor run android-device --verbose

Getting installed version for platform android in Cordova project
Checking Cordova requirements for platform Android
[[[[[ /socially1-3 ]]]]]

=> Started proxy. 
=> Started MongoDB. 
Local package version is up-to-date: accounts-base@1.2.2
....
Local package version is up-to-date: webapp-hashing@1.0.5

Preparing Cordova project from app bundle 
Processing mobile-config.js 
Copying resources for mobile apps 
Writing new config.xml 
Preparing Cordova project for platform Android

WARNING: You are testing your app on a remote device. For the mobile app to be able to connect to the local server, make sure your device is on
the same network, and that the network configuration allows clients to talk to each other (no client isolation).
Running Cordova app for platform Android with options --device
ANDROID_HOME=/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

Running: /socially1-3/.meteor/local/cordova-build/platforms/android/gradlew cdvBuildDebug -b /socially1-3/.meteor/local/cordova-build/platforms/android/build.gradle -PcdvBuildArch=arm -Dorg.gradle.daemon=true
=> Started your app.

=> App running at: http://localhost:3000/ 
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources FAILED

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.

java.io.IOException: Cannot run program "/android-sdk-linux/build-tools/23.0.2/aapt": error=2, No such file or directory
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 29.25 secs
Starting app on Android Device \
/socially1-3/.meteor/local/cordova-build/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /socially1-3/.meteor/local/cordova-build/platforms/android/gradlew with args: cdvBuildDebug,-b,/socially1-3/.meteor/local/cordova-build/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true
=> Errors executing Cordova commands:

While running Cordova app for platform Android with options --device:
Error: Command failed: /socially1-3/.meteor/local/cordova-build/platforms/android/cordova/run
--device

at ChildProcess.exitCallback (/tools/utils/processes.js:137:23)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess.handle.onexit (childprocess.js:820:12)

ExitWithCode:1

我首先想到的文件' aapt '没有该文件或该文件没有权限。但是' aapt'文件在指定的路径上可用,用户也具有读写权限。

enter image description here

2 个答案:

答案 0 :(得分:3)

您正在尝试在64位系统上运行32位文件。试试

>file aapt

它应该给你以下结果

aapt: ELF 32-bit LSB shared object ...

SDK Manager实际上正在安装32位文件..

尝试此修复:

(Using software centre or command lines) If your Ubuntu is a 32-bit OS then install libgl1-mesa-dev

In case of 64-bit OS install ia32-libs (Ubuntu 13.04 or earlier), or libgl1-mesa-dev:i386 (Ubuntu 13.10 and above)

参考:https://askubuntu.com/questions/318246/complete-installation-guide-for-android-sdk-adt-bundle-on-ubuntu

答案 1 :(得分:0)

根据Android开发者网站,

注意:
如果您运行的是 64位版本的Ubuntu ,则需要使用以下命令安装一些32位库:

  

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc ++ 6

如果您正在运行 64位Fedora ,则命令为:

  

sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686

按照安装步骤的链接:
https://developer.android.com/studio/install.html