问题描述
我使用的是 Mac Yosemite.在为 android 平台运行构建时出现以下失败:
I am using Mac Yosemite. Getting the following failure on running a build for android platform :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/sairamk/Development/android-sdk-macosx/build-tools/22.0.1/aapt package -f --no-crunch -I /Users/sairamk/Development/android-sdk-macosx/platforms/android-22/android.jar -M /Users/sairamk/projects/dummy_app/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/sairamk/projects/dummy_app/platforms/android/build/intermediates/res/debug -A /Users/sairamk/projects/dummy_app/platforms/android/build/intermediates/assets/debug -m -J /Users/sairamk/projects/dummy_app/platforms/android/build/generated/source/r/debug -F /Users/sairamk/projects/dummy_app/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.ionicframework.bcgsandbox553389 -0 apk --output-text-symbols /Users/sairamk/projects/dummy_app/platforms/android/build/intermediates/symbols/debug
Error Code:
1
Output:
/Users/sairamk/projects/dummy_app/platforms/android/build/intermediates/res/debug/xml/config.xml:59: error: Error parsing XML: unbound prefix
构建对于 IOS 运行得非常好.我已经安装了 android SDK 并配置了 ANDROID_HOME 和 ANDROID_SDK_ROOT 系统变量.
The build runs perfectly fine for IOS. I have installed android SDK and configured ANDROID_HOME and ANDROID_SDK_ROOT system variables.
还尝试删除平台并再次添加,以使用以下方法获得干净的平台文件夹:
Also tried removing the platform and adding it again, to have a clean platform folder using :
ionic platform remove android
ionic platform add android
但不好.
我已安装的 Android SDK 构建工具版本 - 19.1、20、21.1.2 和 22.0.1
Android SDK build tool versions that I have installed - 19.1,20,21.1.2 and 22.0.1
AndroidManifest.xml 偏好:
AndroidManifest.xml preference :
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
推荐答案
通过在 config.xml 中添加 phonegap 的 xml 命名空间 (xmlns:gap="http://phonegap.com/ns/1.0") 解决了这个问题
This issue gets resolved by adding xml namespace for phonegap (xmlns:gap="http://phonegap.com/ns/1.0") to config.xml
添加后:
<widget id="com.ionicframework.yourpackagename"
version="0.0.1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
xmlns:gap="http://phonegap.com/ns/1.0">
希望它可以帮助面临类似问题的人.
Hope it helps someone facing similar issue.
这篇关于离子构建android失败 - 任务processDebugResources执行失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!