Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Random android.content.res.Resources$NotFoundException

Tags:

For some time we have been receiving weird android.content.res.Resources$NotFoundException exception from our production application (via Play store).

The error commonly appears while trying to access to string resources declared in res/values.

To give a concrete example, in our Application subclass, we load a string ressources in onCreate() method (so at any app launch).

The string resource actually exists in res/values and the production application works fine on all our test devices so it cannot comes from a wrong generation of the R file.

We guessed it came from the fact the the values weren't redefined in other values package (like values-hdpi or other packages) and copying the string values into all packages actually stopped the exceptions.

Still, according to the Android documentation, if no specific values are found, the values of the default package are taken by default so we don't understand why this error occurs.

We are thinking it might be custom roms that don't operate 'normally' so I wanted to know if other people had the same issues or anyone had other suggestions.

like image 995
Xval Avatar asked Jan 08 '13 10:01

Xval


1 Answers

There are so many Android devices with different configurations. So when we don't keep resources specific to corresponding matching device configuration[drawable-hdpi,values-en,layout-land etc] then android system looks into default configurations for that resource[drawable,values & layout].

So recommending to keep both default & configuration specific resources in respective locations.

like image 182
Chandan Adiga Avatar answered Oct 25 '22 08:10

Chandan Adiga