{"id":2362,"date":"2022-08-30T15:24:14","date_gmt":"2022-08-30T15:24:14","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/05\/published-app-crashing-due-to-error-cannot-find-mainactivity-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:24:14","modified_gmt":"2022-08-30T15:24:14","slug":"published-app-crashing-due-to-error-cannot-find-mainactivity-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/published-app-crashing-due-to-error-cannot-find-mainactivity-collection-of-common-programming-errors\/","title":{"rendered":"Published app crashing due to error &ldquo;Cannot find MainActivity&rdquo;-Collection of common programming errors"},"content":{"rendered":"<p>I published app at the Market and I keep getting error:<\/p>\n<pre><code>Exception class: android.content.res.Resources$NotFoundException\nSource method: Resources.getValue()\n\n java.lang.RuntimeException: Unable to start activity\n ComponentInfo{com.xxx.yyy\/com.xxx.yyy.MainActivity}:\n android.content.res.Resources$NotFoundException: Resource ID #0x7f45001c\n<\/code><\/pre>\n<p>The app has the splash image which starts the <code>MainActivity<\/code>. This activity loads the XML file <code>main.xml<\/code>. Nothing unusual. When I load the app in all my phones, I get no error. The same is with all emulators.<\/p>\n<p>It occurred to me that the error may be because of the resource folders in the <code>\/res<\/code> 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.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/GG5FE.png\" \/><\/p>\n<p>It looks like the app tries to load MainActivity. Then it tries to load the layout file <code>main.xml<\/code> and it fails there.<\/p>\n<p>Any suggestions???<\/p>\n<p>Thanks in advdnce<\/p>\n<ol>\n<li>\n<p>You might want to check that you have default versions for all your resources and layouts stored in <code>layout<\/code> and <code>drawable<\/code>. Maybe there is a device that tries to take a resource from <code>layout-large-hdpi<\/code> and since this folder does not exist, it tries to find the resource in <code>layout<\/code>, fails and throws the exception.<\/p>\n<p>At least, it would explain why you don&#8217;t get the exception on your devices.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-01-05 22:29:14. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2362","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2362","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2362"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2362\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2362"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2362"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2362"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}