任务“:processDebugResources”执行失败。 com.android.ide.common.process.ProcessException:无法执行 aapt

Posted

技术标签:

【中文标题】任务“:processDebugResources”执行失败。 com.android.ide.common.process.ProcessException:无法执行 aapt【英文标题】:Execution failed for task ':processDebugResources'. com.android.ide.common.process.ProcessException: Failed to execute aapt 【发布时间】:2018-05-01 23:20:09 【问题描述】:

我附上了cordova构建的完整日志,请建议如何解决这个问题:

cordova build android
....
....    
:processDebugResourcesC:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:170: AAPT: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:176: AAPT: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:182:21-37: AAPT: No resource found that matches the given name: attr 'colorPrimaryDark'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:184: AAPT: Error retrieving parent for item: No resource found that matches the given name 'Widget.Design.TextInputLayout'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:190:21-32: AAPT: No resource found that matches the given name: attr 'colorAccent'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:192:21-42: AAPT: No resource found that matches the given name: attr 'colorControlActivated'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:191:21-39: AAPT: No resource found that matches the given name: attr 'colorControlNormal'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:200: AAPT: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:203:21-40: AAPT: No resource found that matches the given name: attr 'actionMenuTextColor'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:204:21-36: AAPT: No resource found that matches the given name: attr 'windowActionBar'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:170: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:176: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:182: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:184: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.Design.TextInputLayout'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:190: error: Error: No resource found that matches the given name: attr 'colorAccent'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:192: error: Error: No resource found that matches the given name: attr 'colorControlActivated'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:191: error: Error: No resource found that matches the given name: attr 'colorControlNormal'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:200: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:203: error: Error: No resource found that matches the given name: attr 'actionMenuTextColor'.

C:\Users\sushovan\IdeaProjects\cometchat-cordova-sampleapp\platforms\android\build\intermediates\res\merged\debug\values\values.xml:204: error: Error: No resource found that matches the given name: attr 'windowActionBar'.


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
我已经完成了cordova平台更新android,没有任何反应。 我已经完成了cordova平台删除android;科尔多瓦平台添加 安卓;

【问题讨论】:

您使用的是哪个 Cordova 和 Cordova-android 版本? cordova --version = 7.1.0 cordova 平台 = android 6.3.0 您是否尝试过通过Cordova platform remove androidCordova platform add android 再次删除和添加平台 是的,试过了,没有任何反应。同样的问题 【参考方案1】:

我在使用 cordova 和 android 7.0.0 时遇到了类似的问题。 这有帮助:

sudo rm -rf /usr/local/lib/node_modules/npm
brew reinstall node

sudo npm install -g cordova
npm i -g npm to update

cd my_project
cordova platform remove android
cordova platform add android@7.0.0

【讨论】:

以上是关于任务“:processDebugResources”执行失败。 com.android.ide.common.process.ProcessException:无法执行 aapt的主要内容,如果未能解决你的问题,请参考以下文章

Flutter 无法确定任务 ':app:processDebugResources' 的依赖关系

如何解决Android中的“任务':app:processDebugResources'执行失败”?

FAILURE:任务“:app:processDebugResources”执行失败

任务“:app:processDebugResources”执行失败[flutter]

Ionic 上的任务“:processDebugResources”执行失败

任务执行失败:processDebugResources [ Cordova / Ionic ]