Error Building Project in Android Studio \"Error: No resource found that matches the given name (at ____ with value '@drawable/<name>')

社会主义新天地 提交于 2019-11-30 11:43:40

Alright, so after fussing with the rebuild for hours trying different methods (renaming particular files [i.e. those with the problems], rebuilding the app after renaming folders inside the build folder, etc) I finally decided that I would go to the source of the problem and see if it worked like other IDE's. Indeed it did, this is how I performed the fix:

  1. Find the location of the problem - For me, all four of the errors I had were inside the 'build' folder of the project.
  2. Close any open instances of the project
  3. While the project is closed, rename this folder from windows explorer (or other if youre using a different OS) (i.e. If the folders name is "build", rename it to "build.old")
  4. Open the project once more
  5. Go to Build > Rebuild Project

You should not have any issues doing this, like I did.

Specifications:

  • IDE Platform: Android Studio
  • IDE Version: Android Studio (I/O Preview) 0.2.2
  • JRE: 1.7.0_25
Melon Chen

My problem is about @drawable/img_1, the pic is JPEG format, while it's extension name is png, I force to rename it jpg extension. Then it builds successfully.

If anyone is using Gradle and sees this it's good to remind about the convention directory structure.

For Gradle you have to put your resources in src/main/res. I migrated a project to Gradle and got the said error when I hadn't moved the res/ directory from the old structure.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!