{"id":448,"date":"2022-06-02T15:26:02","date_gmt":"2022-06-02T15:26:02","guid":{"rendered":"https:\/\/sidroniolima.com.br\/blog\/?p=448"},"modified":"2022-06-04T22:47:03","modified_gmt":"2022-06-04T22:47:03","slug":"android-app-crashes-after-flutterfire-configure","status":"publish","type":"post","link":"https:\/\/sidroniolima.com.br\/blog\/2022\/06\/02\/android-app-crashes-after-flutterfire-configure\/","title":{"rendered":"Android App crashes after flutterfire configure"},"content":{"rendered":"\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=sidroniolima\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n\n<p>If your app is crashing on startup when runnging a AVD, you should analyse the logcat from &#8216;View &gt; Tool Windows &gt; Logcat.<\/p>\n<p>In my case, the crash cause was:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Caused by: java.lang.ClassNotFoundException: Didn't find class \"br.com.sidroniolima.medo_e_delirio_app.MainActivity\" <\/code><\/pre>\n\n\n\n<p>The problem was at AndroidManifest.xml file.<\/p>\n<p>The activity was pointing to a .MainActivity that is not there. It maybe have been occurred when I configure the flutterfire on project.<\/p>\n<p>The Android Plugin upgrade page shows at the 5th step the following:<\/p>\n<p><a href=\"https:\/\/docs.flutter.dev\/development\/packages-and-plugins\/plugin-api-migration\">Android Plugin update page.<\/a><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>(Optional) If you removed <code>MainActivity.java<\/code>, update the <code>&lt;plugin_name>\/example\/android\/app\/src\/main\/AndroidManifest.xml<\/code> to use <code>io.flutter.embedding.android.FlutterActivity<\/code>. For example:<\/p><\/blockquote>\n\n\n\n<p>The solution was replace the old block to the new one. As follows.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;activity\n            android:name=\".MainActivity\"\n            android:launchMode=\"singleTop\"\n            android:theme=\"@style\/LaunchTheme\"\n            android:configChanges=\"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode\"\n            android:hardwareAccelerated=\"true\"\n            android:windowSoftInputMode=\"adjustResize\"><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;activity\n            android:name=\"io.flutter.embedding.android.FlutterActivity\"\n            android:launchMode=\"singleTop\"\n            android:theme=\"@style\/LaunchTheme\"\n            android:configChanges=\"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode\"\n            android:hardwareAccelerated=\"true\"\n            android:windowSoftInputMode=\"adjustResize\"><\/code><\/pre>\n\n\n\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=sidroniolima\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>If your app is crashing on startup when runnging a AVD, you should analyse the logcat from &#8216;View &gt; Tool Windows &gt; Logcat. In my case, the crash cause was: The problem was at AndroidManifest.xml file. The activity was pointing to a .MainActivity that is not there. It maybe have been occurred when I configure [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-448","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts\/448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/comments?post=448"}],"version-history":[{"count":1,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts\/448\/revisions"}],"predecessor-version":[{"id":449,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/posts\/448\/revisions\/449"}],"wp:attachment":[{"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/media?parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/categories?post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sidroniolima.com.br\/blog\/wp-json\/wp\/v2\/tags?post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}