当前位置: 首页 > 知识库问答 >
问题:

Gradle构建不断失败。未找到文件错误出现在缓存中

施俊明
2023-03-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,但这没有帮助。

编辑=我尝试复制“缓存”。属性的文件。。。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

共有2个答案

裴鸿熙
2023-03-14

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

dataBinding { enabled = true } 

但我的应用程序模块没有包括

dataBinding { enabled = true } 

在android闭包中。然后我添加

dataBinding { enabled = true } 

在我的应用模块Android关闭。然后我的项目可以正常运行。希望这能帮助你。

倪鸿禧
2023-03-14

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

 类似资料:
  • 我似乎不明白为什么JitPack无法构建我的库,当我检查构建日志时,我发现了以下错误和警告: 我试图通过遵循这个StackOverflow答案中的建议来解决Java版本错误,但它没有起到任何作用。 我做错了什么?我如何修复它?

  • 任何想法可能是什么问题?我使用的是渐变 2.6 和 Java 1.8.0_60

  • 我对工作室很陌生, 我正在尝试运行我的应用程序 遇到错误- 哪里出错了: 任务': app: dexDebug'执行失败。 com . Android . ide . common . Process . Process exception:org . grad le . Process . internal . exec exception:Process ' command '/Library

  • 我不知道该怎么办;我卡住了。我有以下依赖关系,以前一切都很好: 然后,突然,它开始说: 我不确定是什么改变了,或者是什么导致了这种情况的发生。

  • 我在运行应用程序时遇到gradle生成错误。我使用的是8GB内存的windows 10,Android studio 4.0.1版 内存不足:Java堆空间。请在项目的Gradle中为Gradle分配更多内存。属性文件。例如,下面的一行,在渐变中。属性文件,将最大Java堆大小设置为1024 MB:org。格雷德尔。jvmargs=-Xmx1024m 即使遵循相同的步骤,我也无法运行该应用程序。有

  • 我试图为android构建一个离子应用程序,但我遇到了这个错误: 我试图更新科尔多瓦和科尔多瓦-CLI,但没有工作。