简体   繁体   English

离子构建android失败 - 任务processDebugResources的执行失败

[英]ionic build android failure - Execution failed for task processDebugResources

I am using Mac Yosemite. 我正在使用Mac Yosemite。 Getting the following failure on running a build for android platform : 在为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

The build runs perfectly fine for IOS. 对于IOS,构建运行完全正常。 I have installed android SDK and configured ANDROID_HOME and ANDROID_SDK_ROOT system variables. 我已经安装了android SDK并配置了ANDROID_HOME和ANDROID_SDK_ROOT系统变量。

Also tried removing the platform and adding it again, to have a clean platform folder using : 还尝试删除平台并再次添加,以使用以下内容创建一个干净的平台文件夹:

ionic platform remove android
ionic platform add android

But no good. 但没有好处。

Android SDK build tool versions that I have installed - 19.1,20,21.1.2 and 22.0.1 我安装的Android SDK构建工具版本--19.1,20,21.1.2和22.0.1

AndroidManifest.xml preference : AndroidManifest.xml首选项:

 <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="22" />

To get more info to debug this go in to the ./platforms/android/ folder and run: 要获得更多信息以进行调试,请转到./platforms/android/文件夹并运行:

Mac users: Mac用户:

gradlew --info build clean

Linux users (thanks Pierre): Linux用户(感谢皮埃尔):

./gradlew --info build clean

Windows users: Windows用户:

gradlew.bat --info build clean

This gives you a lot more detail. 这为您提供了更多细节。

My issue was solved this way, found some files that where incorrectly dropped into the project folder with spaces in the file names. 我的问题以这种方式解决了,发现一些文件错误地放入项目文件夹中,文件名中有空格。

This issue gets resolved by adding xml namespace for phonegap (xmlns:gap="http://phonegap.com/ns/1.0") to config.xml 通过将phonegap(xmlns:gap =“http://phonegap.com/ns/1.0”)的xml命名空间添加到config.xml来解决此问题

After adding : 添加后:

<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. 希望它可以帮助面临类似问题的人。

from ionic forum 来自离子论坛

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). 在哪里运行“离子资源”命令,我查看并检查了/ resources / android / splash文件夹,我点击并打开所有这些png文件,我发现有些图片被破坏了(显示为一半)。

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. 所以我用“普通”png文件(在同一文件夹中)替换这些损坏的png文件,然后运行“ionic build”命令,错误就消失了。

https://forum.ionicframework.com/t/ionic-android-build-problem/29131/7?u=bleuscyther https://forum.ionicframework.com/t/ionic-android-build-problem/29131/7?u=bleuscyther

But in my case, It resolved by removing the below line 但在我的情况下,它解决了删除下面的行

    <gap:plugin name="nl.x-services.plugins.socialsharing" />

from my config.xml file 来自我的config.xml文件

I've got a similar issue. 我有一个类似的问题。 To find a workaround, I've created a new blank project. 为了找到解决方法,我创建了一个新的空白项目。 The compilation and emulation was good. 汇编和仿真很好。 I figure out there were a problem in my www folder. 我发现我的www文件夹中有问题。 After some multiples test, one of my picture got that name : 'Clément.png". Removing the accent to get 'Clement.png' just fixed my problem.... A lot of pain. 经过一些倍数测试后,我的一张照片得到了这个名字:'Clément.png'。删除重音以获得'Clement.png'只是解决了我的问题......很多痛苦。

If you are developing with Windows, it may be because of the "path name". 如果您使用Windows进行开发,可能是因为“路径名”。 Windows doesn't allow the path name longer than 260 char. Windows不允许路径名长于260个字符。 So making it shorter may solve it. 所以缩短它可以解决它。

I've got this problem on Arch Linux on clean Cordova. 我在Arch Linux上的干净Cordova上遇到了这个问题。 To debug this I followed @CapeCorder answer and found that this was missing zlib library. 为了调试这个我跟着@CapeCorder回答,发现这是缺少zlib库。 Simply installed it 只需安装它

sudo pacman -S lib32-zlib

And works well ;) 效果很好;)

Yes, Build successful after removing the below line 是的,删除以下行后构建成功

<gap:plugin name="nl.x-services.plugins.socialsharing" />

from config.xml 来自config.xml

Like some others, my error was caused by some terrible hidden files that were tripping gradle up. 像其他一些人一样,我的错误是由一些可怕的隐藏文件引起的。

In my case it was the special "Icon?" 在我的情况下,它是特殊的“图标?” file that OSX creates inside of any folder that has a custom icon (such as Google Drive, Dropbox, etc). OSX在任何具有自定义图标的文件夹(例如Google Drive,Dropbox等)内创建的文件。 The file is actually named "Icon\\r", and I believe java/gradle is tripping up over the "\\r" (or any unexpected, unescaped character). 该文件实际上名为“Icon \\ r \\ n”,我相信java / gradle会在“\\ r”(或任何意外的非转义字符)上绊倒。

Solution was to nuke all the spurious "Icon?" 解决方案是核对所有虚假的“图标?” files from my project directory: 我的项目目录中的文件:

# 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

I don't know why, but my android platform didn't work. 我不知道为什么,但我的android平台没有用。 Solved the problem by doing : 通过这样做解决了这个问题:

ionic platform rm android
ionic platform add android

For me, turned out to be the long name length of some of the images I had inside the assets folder. 对我来说,原来是我在资产文件夹中的一些图像的长名称长度。

Just be aware. 请注意。 After deleting those images I was still getting the same error. 删除这些图像后,我仍然得到相同的错误。 The reason being that the images persisted inside the www folder. 原因是图像持久存在www文件夹中。 Deleted that folder and worked! 删除该文件夹并工作!

我使用Vue.js和Webpack生成生产文件,输出包含* .gz文件,如果放入Cordova的www /中则会出现问题。

In my case, it was pushwoosh plugin. 就我而言,它是pushwoosh插件。

<gap:plugin name="pushwoosh-phonegap-plugin">

We don't need to remove the plugin. 我们不需要删除插件。 Just set the version of plugin which is worked last time. 只需设置上次工作的插件版本即可。 This is worked for me. 这对我有用。

<gap:plugin name="pushwoosh-phonegap-plugin"  spec="7.0.4" source="npm"/>

Try this (Worked for me): 试试这个(为我工作):

  1. Uninstall Current JDK 卸载当前JDK
  2. Install Latest JDK 安装最新的JDK
  3. Run: cordova build --debug android 运行: cordova build --debug android

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 离子:执行失败的任务&#39;processdebugresources&#39; - Ionic: execution failed for task ' processdebugresources' 无法完成任务的离子项目执行失败:processDebugResources&#39; - Build failed ionic project execution failed for task : processDebugResources' 任务&#39;:app:processDebugResources&#39;的执行失败。 无法执行Aapt Ionic 4 Android - Execution failed for task ':app:processDebugResources'. Failed to execute aapt Ionic 4 android FAILURE:任务“:app:processDebugResources”执行失败 - FAILURE: Execution failed for task ':app:processDebugResources' phonegap build fail:任务执行失败&#39;:processDebugResources&#39; - phonegap build fail : Execution failed for task ':processDebugResources' 无法构建ionic3项目,错误:任务&#39;:app:processDebugResources&#39;的执行失败。 &gt;无法执行aapt - Can't build an ionic3 project, error: Execution failed for task ':app:processDebugResources'. > Failed to execute aapt Android:任务执行失败&#39;:app:processDebugResources&#39; - Android: Execution failed for task ':app:processDebugResources' Android Studio 执行任务“:app:processDebugResources”失败。 - Android Studio Execution failed for task ':app:processDebugResources'. 错误:任务&#39;:app:processDebugResources&#39;android的执行失败 - Error:Execution failed for task ':app:processDebugResources' android Android Cordova构建失败(任务&#39;:app:processDebugResources&#39;的执行失败)[Cordova / Vuejs] - Android Cordova build failed (Execution failed for task ':app:processDebugResources') [Cordova / Vuejs]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM