KenAragorn/create_flutter_provider_app

App crash after build: FATAL EXCEPTION: main - java.lang.RuntimeException: Unable to instantiate activity - java.lang.ClassNotFoundException: Didn't find class "com.NAME.APPNAME.MainActivity" on path: DexPathList

Closed this issue · 3 comments

I took me way to long to fix this error, so I hope this helps someone else:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.NAME.APPNAME.dev/com.NAME.APPNAME.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.NAME.APPNAME.MainActivity" on path: DexPathList[[zip file "/data/app/com.NAME.APPNAME.dev-XzP2FDlcF7ok_QeihJlBQQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.NAME.APPNAME.dev-XzP2FDlcF7ok_QeihJlBQQ==/lib/x86, /data/app/com.NAME.APPNAME.dev-XzP2FDlcF7ok_QeihJlBQQ==/base.apk!/lib/x86, /system/lib]]

Maybe this error came because I renamed the bundle itentifier in the AndroidManifest files and everywhere else I could find it. This step wasn´t explicitly explained in the setup of the project.

My solution in the end was to also rename the "android/app/src/main/kotlin/com/venturearkstudio/noteapp" folder structure into my bundle identifier ".../com/NAME/APPNAME". And then also in the MainActivity.kt file the "package com.venturearkstudio.noteapp" to "package com.NAME/APPNAME".

Not sure if these steps should be added into the setup instructions or if I made something wrong and then ran into this issue.

Hello @rainerlonau ,

Thanks for the heads up!
Sorry, was away for few short day. Yes, that is 1 way to fix the MainActivity issue. But, so far this is the first time I saw issue as this. Let me do a update on the latest Flutter build on this project and try.

Maybe this error came because I renamed the bundle itentifier in the AndroidManifest files and everywhere else I could find it. This step wasn´t explicitly explained in the setup of the project.

I guess it´s because of what I mentioned. In your setup you have a few spots where you explain to change the bundle identifier. But I changed it also in other places and I guess that´s when MainActivity could be found anymore because the folders were not renamed correctly (at first)

Ok, great. After I complete a new project that used this package, I will update the README on this. Thanks again.:)