Android: resources do not contain package for resource number 0x

I am writing on a custom view in Android. It uses some png provided as resources in the drawable folder (now I put it in all available folders to make sure) of my project.

Unfortunately, when I launch the application, I gain strength and the last thing the magazine says is: "WARN/ResourceType(261): Resources don't contain package for resource number 0x7f020002" (Hex-Number is the first icon I intend to download )

Now for the curious thing: the eclipse adt plugin graphical layout editor has no problem loading the icon display in its design view. This is only when I run the actual application (emulator or real cell phone), this android can not find resources.

I tried to clean the project and update the file structure. It didn't quite work. -

EDIT: I just realized that I can't even load a string resource. It seems that the problem exists for all resources. Do I have to do something before resources become available?

Hope someone can help me

thanks in advance

+3
source share
3 answers

kk, this year I get dumb awards. I used Resources.getSystem().get... instead of this.getContext().getResources().get...

thank you all for your help

0
source

In some cases, when adding resource files to res dir, the generated R-class does not synchronize with its assets. If you compile on the command line using ant, try going to the build scripts and doing a clean build:

 ant clean 

I really don't know much about eclipse, but there may be a way to tell eclipse to update the generated files.

+1
source

I had the same problem in the v2.1 emulator, while the same application runs smoothly in AVIs 1.5.1.6.2.3.x and 4.x.

I use the library in my project. The resource number was not even in the R.java file. So, in the end, I found that the resource identifier was in another R package file that had nothing to do with my project. After deleting this project and cleaning up the projects, the application loaded smoothly :)

0
source

Source: https://habr.com/ru/post/1447288/


All Articles