ionic build android 失败 - 任务 processDebugResources 执行失败
ionic build android failure - Execution failed for task processDebugResources
我正在使用 Mac Yosemite。在 运行 为 android 平台构建时出现以下故障:
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 系统变量。
还尝试删除平台并再次添加,以使用以下方法获得干净的平台文件夹:
ionic platform remove android
ionic platform add android
但是不行。
Android 我安装的 SDK 构建工具版本 - 19.1、20、21.1.2 和 22.0.1
AndroidManifest.xml 偏好:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
通过将 phonegap (xmlns:gap="http://phonegap.com/ns/1.0") 的 xml 命名空间添加到 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">
希望对遇到类似问题的人有所帮助。
但就我而言,通过删除下面的行解决了问题
<gap:plugin name="nl.x-services.plugins.socialsharing" />
来自我的 config.xml 文件
来自离子论坛
It was because of the "ionic resource" service error.
where run "ionic resource" command, I looked into and checked the
/resources/android/splash folder, I clicked and open all of these png
files, I found some pictures were broken(which appears as half of it).
So I replace these broken png files with the "normal" png file(at the
same folder), then run "ionic build" command, the error is
disappeared.
https://forum.ionicframework.com/t/ionic-android-build-problem/29131/7?u=bleuscyther
我遇到了类似的问题。
为了找到解决方法,我创建了一个新的空白项目。
编译和仿真都很好。
我发现我的 www 文件夹有问题。
经过多次测试后,我的一张照片得到了这个名字:“Clément.png”。
删除重音以获得 'Clement.png' 刚刚解决了我的问题....
很痛苦。
要获取更多信息以进行调试,请进入 ./platforms/android/
文件夹和 运行:
Mac 用户:
gradlew --info build clean
Linux 用户(感谢 Pierre):
./gradlew --info build clean
Windows 用户:
gradlew.bat --info build clean
这为您提供了更多详细信息。
我的问题是这样解决的,发现一些文件被错误地放入项目文件夹,文件名中有空格。
我在干净的 Cordova 上的 Arch Linux 上遇到了这个问题。为了调试这个,我按照@CapeCorder 的回答发现它缺少 zlib
库。
简单安装一下
sudo pacman -S lib32-zlib
而且效果很好 ;)
是的,删除下面的行后构建成功
<gap:plugin name="nl.x-services.plugins.socialsharing" />
来自 config.xml
和其他一些人一样,我的错误是由一些可怕的隐藏文件引起的 gradle。
在我的例子中,它是 OSX 在具有自定义图标(例如 Google Drive、Dropbox 等)的任何文件夹中创建的特殊 "Icon?" 文件。该文件实际上被命名为 "Icon\r",我相信 java/gradle 被“\r”(或任何意外的、未转义的字符)绊倒了。
解决方案是从我的项目目录中删除所有虚假的 "Icon?" 文件:
# note that this is the syntax for zsh.
# If you're using bash test out the pattern first before including '-delete'
find ~/code/myproject/ -name Icon$'\r' -delete
我不知道为什么,但我的 android 平台不起作用。通过执行以下操作解决了问题:
ionic platform rm android
ionic platform add android
试试这个(对我有用):
- 卸载当前 JDK
- 安装最新版本JDK
- 运行:
cordova build --debug android
对我来说,原来是我在资产文件夹中的一些图像的长名称长度。
请注意。删除这些图像后,我仍然遇到同样的错误。原因是图像保存在 www
文件夹中。删除了该文件夹并成功了!
我使用Vue.js和Webpack生成生产文件,输出包含*.gz文件,如果放入Cordova的www/就会出现问题。
如果您使用 Windows 进行开发,可能是因为 "path name"。 Windows 不允许路径名超过 260 个字符。所以缩短它可能会解决它。
就我而言,它是 pushwoosh 插件。
<gap:plugin name="pushwoosh-phonegap-plugin">
我们不需要删除插件。只需设置上次运行的插件版本即可。这对我有用。
<gap:plugin name="pushwoosh-phonegap-plugin" spec="7.0.4" source="npm"/>
我正在使用 Mac Yosemite。在 运行 为 android 平台构建时出现以下故障:
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 系统变量。
还尝试删除平台并再次添加,以使用以下方法获得干净的平台文件夹:
ionic platform remove android
ionic platform add android
但是不行。
Android 我安装的 SDK 构建工具版本 - 19.1、20、21.1.2 和 22.0.1
AndroidManifest.xml 偏好:
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />
通过将 phonegap (xmlns:gap="http://phonegap.com/ns/1.0") 的 xml 命名空间添加到 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">
希望对遇到类似问题的人有所帮助。
但就我而言,通过删除下面的行解决了问题
<gap:plugin name="nl.x-services.plugins.socialsharing" />
来自我的 config.xml 文件
来自离子论坛
It was because of the "ionic resource" service error.
where run "ionic resource" command, I looked into and checked the /resources/android/splash folder, I clicked and open all of these png files, I found some pictures were broken(which appears as half of it).
So I replace these broken png files with the "normal" png file(at the same folder), then run "ionic build" command, the error is disappeared.
https://forum.ionicframework.com/t/ionic-android-build-problem/29131/7?u=bleuscyther
我遇到了类似的问题。 为了找到解决方法,我创建了一个新的空白项目。 编译和仿真都很好。 我发现我的 www 文件夹有问题。 经过多次测试后,我的一张照片得到了这个名字:“Clément.png”。 删除重音以获得 'Clement.png' 刚刚解决了我的问题.... 很痛苦。
要获取更多信息以进行调试,请进入 ./platforms/android/
文件夹和 运行:
Mac 用户:
gradlew --info build clean
Linux 用户(感谢 Pierre):
./gradlew --info build clean
Windows 用户:
gradlew.bat --info build clean
这为您提供了更多详细信息。
我的问题是这样解决的,发现一些文件被错误地放入项目文件夹,文件名中有空格。
我在干净的 Cordova 上的 Arch Linux 上遇到了这个问题。为了调试这个,我按照@CapeCorder 的回答发现它缺少 zlib
库。
简单安装一下
sudo pacman -S lib32-zlib
而且效果很好 ;)
是的,删除下面的行后构建成功
<gap:plugin name="nl.x-services.plugins.socialsharing" />
来自 config.xml
和其他一些人一样,我的错误是由一些可怕的隐藏文件引起的 gradle。
在我的例子中,它是 OSX 在具有自定义图标(例如 Google Drive、Dropbox 等)的任何文件夹中创建的特殊 "Icon?" 文件。该文件实际上被命名为 "Icon\r",我相信 java/gradle 被“\r”(或任何意外的、未转义的字符)绊倒了。
解决方案是从我的项目目录中删除所有虚假的 "Icon?" 文件:
# note that this is the syntax for zsh.
# If you're using bash test out the pattern first before including '-delete'
find ~/code/myproject/ -name Icon$'\r' -delete
我不知道为什么,但我的 android 平台不起作用。通过执行以下操作解决了问题:
ionic platform rm android
ionic platform add android
试试这个(对我有用):
- 卸载当前 JDK
- 安装最新版本JDK
- 运行:
cordova build --debug android
对我来说,原来是我在资产文件夹中的一些图像的长名称长度。
请注意。删除这些图像后,我仍然遇到同样的错误。原因是图像保存在 www
文件夹中。删除了该文件夹并成功了!
我使用Vue.js和Webpack生成生产文件,输出包含*.gz文件,如果放入Cordova的www/就会出现问题。
如果您使用 Windows 进行开发,可能是因为 "path name"。 Windows 不允许路径名超过 260 个字符。所以缩短它可能会解决它。
就我而言,它是 pushwoosh 插件。
<gap:plugin name="pushwoosh-phonegap-plugin">
我们不需要删除插件。只需设置上次运行的插件版本即可。这对我有用。
<gap:plugin name="pushwoosh-phonegap-plugin" spec="7.0.4" source="npm"/>