【问题标题】:Error: java.io.IOException: build on Android device failed at task 'processDebugResources'错误:java.io.IOException:在 Android 设备上构建任务“processDebugResources”失败
【发布时间】:2016-01-27 12:27:40
【问题描述】:

我使用的是 Ubuntu 12.04.4 LTS,而我的安卓手机是

Samsung 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”:错误=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”文件在指定路径下可用,并且用户也有读写权限。

【问题讨论】:

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


    【解决方案1】:

    您正试图在 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

    【讨论】:

    • 确实文件 aapt 显示文件是 32 位的,因为我的是 ubuntu12.04LTS,所以我安装了 sudo apt-get install ia32-libs 。现在流星没有产生上述错误
    【解决方案2】:

    根据 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      • 2015-08-19
      • 2016-10-24
      • 2016-10-18
      • 2017-10-19
      • 1970-01-01
      • 2021-08-11
      相关资源
      最近更新 更多