在OSX El Capitan上的离子构建android失败 - :processDebugResources

时间:2016-08-06 05:33:57

标签: android macos cordova ionic-framework

好吧,我有一台带有El Capitan的Mac,我需要模拟并构建一个使用Ionic / cordova创建的Android应用程序,但所有时间都遇到像Execution failed for task ':processDebugResources'.

这样的问题

我的配置是:

sh-3.2# ionic info

Your system information:

Cordova CLI: 6.3.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 1.2.4
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.8.6
ios-sim version: 5.0.8 
OS: Mac OS X El Capitan
Node Version: v6.3.1
Xcode version: Xcode 7.3.1 Build version 7D1014 

在我的〜/ .bash_profile

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
export ANT_HOME=/usr/local/Cellar/ant/1.9.7/libexec
export ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
export PATH=${PATH}:${PATH}/tools:${PATH}/platform-tools:${ANT_HOME}/bin

安装了应用

  • Android SDK 24.4.1
  • Java SE Development Kit 8(1.8.0)
  • Ant 1.9.7
  • Android Studio 2.1.2
  • 已安装Android SDK API级别列表:24,23,22,21,20,19,18,17,16,15和14

我的问题:

当我运行命令ionic emulate androidionic build android时,返回输出:

Running command: /Users/MyMacPro/Desktop/MyApp/hooks/after_prepare/010_add_platform_class.js /Users/MyMacPro/Desktop/MyApp
add to body class: platform-android
ANDROID_HOME=/usr/local/Cellar/android-sdk/24.4.1_1
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/24.0.1/aapt'' finished with non-zero exit value 1

* 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: 18.044 secs
Error: /Users/MyMacPro/Desktop/MyApp/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/Cellar/android-sdk/24.4.1_1/build-tools/24.0.1/aapt'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

所以,我不知道我的错误是什么,因为我已经安装了所有需要的应用程序。

谢谢!

1 个答案:

答案 0 :(得分:0)

我的解决方案:

  

此解决方案解决了Android问题,如果您需要解决iOS问题   问题,也许你需要了解 ios-sim

# First, Install nodejs
brew install node

# install cordova
sudo npm install -g cordova

# install cordova
sudo npm install -g ionic
sudo npm install -g ionic

# install android sdk: android, adb, etc
brew install android-sdk

# Execute android
android
# after run android you need install
# Tools: Andoird SDK Tools, Android SDK Platform-tools, Android SDK Build-tools
# Android 4.4.2 (API 19)
# Extras: Android Support Library

# install ant
brew install ant

然后,在安装所有依赖项之后,您可以创建一个新的离子项目 喜欢

ionic start <YouAppNameHere> blank

然后你需要用

添加android平台支持
ionic platform add android

最后,您可以使用

构建模拟为Android设备投影
ionic build android

ionic emulate android
  

您可以将旧的www文件夹数据移动/复制到新的www文件夹,以及   可以使用plugins

手动安装旧版ionic plugin add <YouPluginNameHere>