Published app crashing due to error “Cannot find MainActivity”-Collection of common programming errors
I published app at the Market and I keep getting error:
Exception class: android.content.res.Resources$NotFoundException
Source method: Resources.getValue()
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.xxx.yyy/com.xxx.yyy.MainActivity}:
android.content.res.Resources$NotFoundException: Resource ID #0x7f45001c
The app has the splash image which starts the MainActivity
. This activity loads the XML file main.xml
. Nothing unusual. When I load the app in all my phones, I get no error. The same is with all emulators.
It occurred to me that the error may be because of the resource folders in the /res
dir. I have the following layout folders (look at the image). I have to have many layout folders as the layout of the MainActivity is such that I have to position its elements at special X and Y coordinates at the special distance from top and left margin.
It looks like the app tries to load MainActivity. Then it tries to load the layout file main.xml
and it fails there.
Any suggestions???
Thanks in advdnce
-
You might want to check that you have default versions for all your resources and layouts stored in
layout
anddrawable
. Maybe there is a device that tries to take a resource fromlayout-large-hdpi
and since this folder does not exist, it tries to find the resource inlayout
, fails and throws the exception.At least, it would explain why you don’t get the exception on your devices.