How to find the resource name from exception
While running an application, I got the following exception.
a开发者_开发百科ndroid.content.res.Resources$ResourcesNotFoundException: Resource ID # 0X7F03000a
The exception trace points to the method- setContentView(R.layout.main) But main.xml is present in the application directory.
How can I identify the resource name from the resource ID?
Thanks in advance!
Usually when something like that happens, it's because the build screwed up somehow so the generated R class doesn't have it.
In Eclipse, go to Project->Clean...
and select your project. It will build your application from scratch.
Also, make sure that the layout main.xml
is in the res/layout
folder. It must be in that folder for Eclipse to auto-generate properly.
You can find it in the R class, it is a class generated automatically. If you are using eclipse, you can find it in the "gen" folder.
精彩评论