开发者

How to find the resource name from exception

开发者 https://www.devze.com 2023-03-27 12:55 出处:网络
While running an application, I got the following exception. a开发者_开发百科ndroid.content.res.Resources$ResourcesNotFoundException: Resource ID # 0X7F03000a

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消