【问题标题】:Gradle build keeps failing. File not found error comes in cacheGradle 构建不断失败。文件未找到错误出现在缓存中
【发布时间】:2016-04-01 20:33:14
【问题描述】:

几周前,我正在编写一个应用程序。那时它工作并成功运行。今天我尝试打开 Android Studio,但我在 gradle 构建中不断收到以下错误:

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:prepareDebugDependencies
:app:compileDebugAidl
FAILURE: Build failed with an exception.

* What went wrong:
java.io.FileNotFoundException: C:\Users\Yasmeen\Desktop\Tarikh Uni\OrganiserApp\Organiser\.gradle\2.8\taskArtifacts\cache.properties (The system cannot find the file specified)
> C:\Users\Yasmeen\Desktop\Tarikh Uni\OrganiserApp\Organiser\.gradle\2.8\taskArtifacts\cache.properties (The system cannot find the file specified)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


BUILD FAILED

Total time: 4.88 secs

我不知道该怎么办。我已经用谷歌搜索了它并尝试了一些答案,比如删除 .gradle 文件夹中的脚本文件夹,然后重新启动 Android Studio,但这没有帮助。

EDIT = 我尝试将“cache.properties”文件从 ...2.8/cache 文件夹复制到我的项目中。它确实进一步进入了 gradle 构建,但现在出现了这些错误。显示在 gradle 控制台构建中:

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:prepareDebugDependencies
:app:compileDebugAidl
: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
:app:processDebugManifest
:app:processDebugResources
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027windowActionBar\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":10,"startColumn":4,"startOffset":384,"endLine":13,"endColumn":12,"endOffset":532}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027windowNoTitle\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":10,"startColumn":4,"startOffset":384,"endLine":13,"endColumn":12,"endOffset":532}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027windowActionBar\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values-v21\\styles.xml","position":{"startLine":2,"startColumn":4,"startOffset":20,"endLine":7,"endColumn":12,"endOffset":321}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027windowNoTitle\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values-v21\\styles.xml","position":{"startLine":2,"startColumn":4,"startOffset":20,"endLine":7,"endColumn":12,"endOffset":321}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat.Light.DarkActionBar\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\build\\intermediates\\res\\merged\\debug\\values\\values.xml","position":{"startLine":19}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027colorAccent\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":3,"startColumn":4,"startOffset":57,"endLine":8,"endColumn":12,"endOffset":376}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027colorPrimary\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":3,"startColumn":4,"startOffset":57,"endLine":8,"endColumn":12,"endOffset":376}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027colorPrimaryDark\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\src\\main\\res\\values\\styles.xml","position":{"startLine":3,"startColumn":4,"startOffset":57,"endLine":8,"endColumn":12,"endOffset":376}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027ThemeOverlay.AppCompat.Dark.ActionBar\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\build\\intermediates\\res\\merged\\debug\\values\\values.xml","position":{"startLine":25}}],"original":"","tool":"AAPT"}

AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027ThemeOverlay.AppCompat.Light\u0027.","sources":[{"file":"C:\\Users\\Yasmeen\\Desktop\\Tarikh Uni\\OrganiserApp\\Organiser\\app\\build\\intermediates\\res\\merged\\debug\\values\\values.xml","position":{"startLine":30}}],"original":"","tool":"AAPT"}


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Yasmeen\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 8.22 secs

来自 gradles 消息构建:

    Error:(3, 5) No resource found that matches the given name: attr 'windowActionBar'.
C:\Users\Yasmeen\Desktop\Tarikh Uni\OrganiserApp\Organiser\app\src\main\res\values-v21\styles.xml
C:\Users\Yasmeen\Desktop\Tarikh Uni\OrganiserApp\Organiser\app\src\main\res\values\styles.xml
Error:(3, 5) No resource found that matches the given name: attr 'windowNoTitle'.
Error:(11, 5) No resource found that matches the given name: attr 'windowNoTitle'.
Error:(11, 5) No resource found that matches the given name: attr 'windowActionBar'.
Error:(4, 5) No resource found that matches the given name: attr 'colorAccent'.
Error:(4, 5) No resource found that matches the given name: attr 'colorPrimary'.
Error:(20) Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Error:(4, 5) No resource found that matches the given name: attr 'colorPrimaryDark'.
C:\Users\Yasmeen\Desktop\Tarikh Uni\OrganiserApp\Organiser\app\build\intermediates\res\merged\debug\values\values.xml
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Dark.ActionBar'.
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'ThemeOverlay.AppCompat.Light'.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Yasmeen\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

【问题讨论】:

  • 找到任何解决方案?

标签: java android caching


【解决方案1】:

尝试路径中没有空格。 \Tarikh Uni\

【讨论】:

  • 但这就是文件夹名称。如何修复空间?我可以重命名它吗?
  • 将您的项目移动到不同的位置,因此指向它的任何文件夹中都没有空格。不能保证工作,但经常是问题。昨天刚刚用 Android Studio 和 Gradle 完成了这个
  • 我创建了一个新项目,将清单文件、布局和活动文件复制到新项目中。我希望这会起作用,但它不起作用。 gradle build 在这部分不断给出错误::app:processDebugResources
  • 我很想知道\u0027windowActionBar\u0027 你还有一些不属于他们的' 吗? \u0027 = '
【解决方案2】:

我统计过同样的问题,因为我的应用模块依赖另一个库,它们都依赖一个通用库。公共库的build.gradle包括

dataBinding { enabled = true } 

但是我的应用模块没有包含

dataBinding { enabled = true } 

在 android 闭包中。 然后我添加

dataBinding { enabled = true } 

在我的应用程序模块 android 闭包中。那么我的项目就可以正常运行了。 希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2021-12-28
    • 1970-01-01
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-22
    相关资源
    最近更新 更多