即使使用最新的构建工具,任务':app:processDebugResources'的执行也失败了

I.s*_*shL 17 android android-resources android-studio build.gradle

我尝试运行我的项目时收到此错误.我已经安装了最新的构建工具-23.0.3但仍然存在错误.我该如何解决?

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources]

Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72321Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2321Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72321Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2321Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest
:app:processDebugResources
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:TextAppearance.Material.Widget.Button.Inverse\u0027.","sources":[{"file":"C:\\Users\\Ishmita\\Documents\\GitHub\\FurAlert-Native-Build\\app\\build\\intermediates\\res\\merged\\debug\\values-v23\\values-v23.xml","position":{"startLine":3}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027android:Widget.Material.Button.Colored\u0027.","sources":[{"file":"C:\\Users\\Ishmita\\Documents\\GitHub\\FurAlert-Native-Build\\app\\build\\intermediates\\res\\merged\\debug\\values-v23\\values-v23.xml","position":{"startLine":32}}],"original":"","tool":"AAPT"}


FAILED

FAILURE: Build failed with an exception.
Run Code Online (Sandbox Code Playgroud)
  • 出了什么问题:任务':app:processDebugResources'执行失败.

    com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程 '命令' C:\用户\ Ishmita \应用程序数据\本地\的Android\SDK \构建工具\ 23.0.3\AAPT .exe''以非零退出值1结束

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.

建筑失败

总时间:5.901秒

SDK经理

jaz*_*bpn 20

在我的例子中,通过使app build.gradle相同来解决问题... compileSdkVersion和buildToolsVersion.

library build.gradle

android {

    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    .....
    .....
}
Run Code Online (Sandbox Code Playgroud)

app build.gradle

android {

    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    .....
    .....
}
Run Code Online (Sandbox Code Playgroud)


Com*_*are 14

compileSdkVersion在模块的build.gradle文件中将您设置为23 .

  • 没有解决我同样的问题 (5认同)

Tou*_*der 7

错误:任务com.android.ide.common.process.ProcessException的执行失败:org.gradle.process.internal.ExecException:

完成非零退出值1

发生此错误的一个原因是资源文件的文件路径为long:

Error: File path too long on Windows, keep below 240 characters 
Run Code Online (Sandbox Code Playgroud)

修复:将项目文件夹移近磁盘根目录

不要:// folder/folder/folder/folder/very_long_folder_name/MyProject ...

Do:// folder/short_name/MyProject


另一个原因可能是重复的资源或名称空间

例:

  <style name="MyButton" parent="android:Widget.Button">
      <item name="android:textColor">@color/accent_color</item>
      <item name="android:textColor">#000000</item>
  </style>
Run Code Online (Sandbox Code Playgroud)

并确保所有文件名和扩展名都是小写的

错误

myimage.PNG
myImage.png
Run Code Online (Sandbox Code Playgroud)

正确

my_image.png
Run Code Online (Sandbox Code Playgroud)

确保清理/重建项目

(删除'build'文件夹)