简体   繁体   English

“找不到资源”错误Android gradle为.gradle / caches中的文件构建

[英]“No resource found” errors Android gradle build for files in .gradle/caches

My Gradle build on Android Studio fails with multiple errors such as. 我在Android Studio上构建的Gradle失败,出现多个错误,例如。

C:\Users\%USER_HOME%\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\67e074a850e794c5187b156467264a93\res\layout\abc_alert_dialog_material.xml

Error:(26, 22) No resource found that matches the given name (at 'layout' with value '@layout/abc_alert_dialog_title_material').

The project is an exercise code of Udacity Android course. 该项目是Udacity Android课程的练习代码。 I have no changes of my own. 我自己没有变化。 It compiles fine when others try. 当其他人尝试时,它编译良好。

Anyone seen the same? 有人看到过吗?

Delete your build cache and then rebuild your project ie, 删除您的构建缓存,然后重新构建您的项目,即

  • Delete the build folder inside your app directory 删除应用directory的构建文件夹
  • Rebuild your project and then try again 重建您的项目,然后再试一次

I was getting these errors because the project name was very long, and the location I was saving the project in, added to it. 我收到这些错误消息是因为项目名称很长,并且将我保存项目的位置添加到了项目中。 That apparently caused some files to be missing. 这显然导致某些文件丢失。 Moving the project to another location so that the file names are not crossing the system limit resolved the errors for me. 将项目移动到另一个位置,以便文件名不超过系统限制,为我解决了这些错误。

Thank you all for your help! 谢谢大家的帮助!

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM