Exception raised during rendering: Could not find layout resource matching value 0x7F04001B (resolved name: content_main) in current configuration
Asked Answered
S

7

13

Getting this exception when I created a new project with a new Activity.

Exception raised during rendering: Could not find layout resource matching value 0x7F04001B (resolved name: content_main) in current configuration.

enter image description here

When I go into the content_main, I do see a proper image and no rendering problems.

enter image description here

Sipes answered 7/6, 2016 at 22:0 Comment(0)
F
27

I have been getting the same issues since I updated Android Studio. It seems to be affecting only layouts with include tags in them.

If you go to "File > Invalidate Caches/Restart...", click "Invalidate and Restart", then wait a minute or two wile AS does its thing it should cause them to show up again.

Fenn answered 7/6, 2016 at 23:1 Comment(0)
V
3

Here is another way to get rid of this error.

  1. Go to the Project folder where the XML file resides, (in the case of OP's question, this would be the content_main.xml file).
  2. Rename the file to anything else such as ren_content_main.xml.
  3. Rebuild the project. The compiler will complain that ren_content_main.xml resource does not exist. Ignore these errors.
  4. Rename the file back to the original name i.e content_main.xml.
  5. Rebuild the project again.
  6. Watch the error disappear like magic.
Varioloid answered 30/3, 2017 at 14:29 Comment(0)
B
1

go to "File > Invalidate Caches/Restart...", click "Invalidate and Restart",then comment out whole code then remove the comment. It worked for me.

Brentwood answered 20/8, 2021 at 15:10 Comment(0)
C
0

Inspired by the other answers, I just cleaned and rebuilt the project, then the error message was gone.

I.e.,

Build => Clean Project
Build => Rebuild Project
Catlin answered 20/12, 2020 at 13:27 Comment(0)
P
0

Unfortunately invalidating cache and restart or clean and rebuild did not work for me. So I tried to commit all the changes except the ones in that layout and then stash the change in that layout. Now the layout stopped throwing that error and rendered back to normal. Thankfully I did not make much additions to the layout which was throwing error so I was okay with stashing.

Peroxide answered 19/6, 2021 at 7:55 Comment(0)
I
0

just copy the text highlighted in red and put it in the newly created element (it's empty initially)enter image description here

Imperator answered 22/12, 2022 at 12:12 Comment(0)
S
0

Here "Sync Project with Gradle files" solved the problem for me. If the other options fail, try it too

Sanjiv answered 31/7, 2024 at 11:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.