Take the 2-minute tour ×

So I am not such a newbie in Programming, Java or Android developing, but I got a strange issue: I have made an application, quite advanced, and have it on market.

For now I have over 1000 installs and I have around 4 or 5 crash reports for a ResourceNotFoundException. The strangest thing is that the line it crashes on is on


In code I am always referring to resourced by


So I am wondering if I used

mContext.getResources().getDrawable(mContext.getResources().getIdentifier("some_string", "string", "my.example.package"));

would the crash go away?

share|improve this question
add comment

5 Answers

up vote 2 down vote accepted

I was facing the same issue and I fixed it by creating Layout Folder called "layout-small".

Based on resolutions I have created only 2 folders "layout-large" and "layout-medium". But few phones are having lower resolution it doesn't find proper resources as per the resolution. Android OS renders xml resources as per resolution. It goes and find the resources in required folders.

95+ % Android phones having resolution which matches "layout-normal" folder. But still there are Phones having lower resolution. Hence this issue occurred.

For more Details : http://developer.android.com/guide/practices/screens_support.html

Hope this helps your problem.

share|improve this answer
add comment

If you are calling setContentView(R.layout.some_custom_layout) from the Activity's onCreate method, you should be good as long as your app compiles (and I assume it does).

AFAIK accessing your string resources via:


is not the way to go. You should be doing this:

share|improve this answer
It does compile and the strangest thing is that in the majority of cases ( 99%) it does not crash and it does well. However, there is this one percent of users who can't start the app due to this bug. I am wondering what could be making it. –  Norbert Dec 4 '11 at 14:32
but did you try accessing your string resources the way I mentioned? I think the way your accessing your strings might be wrong. –  Code Poet Dec 4 '11 at 14:43
The string accessing example was just an example, I haven't seen a report that it actually crashes there. I meant that every where that I use a resource ID I use it trough "R" –  Norbert Dec 4 '11 at 15:05
add comment



try using


that helped me a lot of times.

share|improve this answer
Never thought of that, I will try it and see if does helps. Thanks. –  Norbert Dec 4 '11 at 14:32
NP Norbert... :D A lot of times that helped me... –  Markonato Dec 4 '11 at 14:52
The only time this would help is if you have imported android.R instead of yourPackageName.R –  Sojurn Jul 17 '13 at 6:11
add comment

I have one suggestion. Do you use in your layouts android secific resources, such as drawables or something, for example


Maybe some vendors don't provide some resources with their firmware, so your app crashs. for example this issue

share|improve this answer
add comment

There you set integer value to text. Its not correctly becouse it search a resousre on this value. You must write

share|improve this answer
add comment

Your Answer


