Home > OS >  Ionic/Cordova app does not find MainActivity
Ionic/Cordova app does not find MainActivity

Time:10-26

My app (Ionic 5 Cordova 9.1.0) crashes when I try to start it on an Android 11 phone. When I look into the logs with logcat I see that the main activity is not found:

10-21 16:31:29.281 5300 5300 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{de.meingolfclub.myapp/de.meingolfclub.myapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "de.meingolfclub.myapp.MainActivity" on path: DexPathList[[zip file "/data/app/~~7FMRVcshmIuFxkzCRS8B2g==/de.meingolfclub.myapp-kbOatrQJj_K4ZJHsuXESTg==/base.apk"],nativeLibraryDirectories=[/data/app/~~7FMRVcshmIuFxkzCRS8B2g==/de.meingolfclub.myapp-kbOatrQJj_K4ZJHsuXESTg==/lib/arm64, /data/app/~~7FMRVcshmIuFxkzCRS8B2g==/de.meingolfclub.myapp-kbOatrQJj_K4ZJHsuXESTg==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]

I googled a bit and it seems to be related to multiDex functionality of Android, but I have no idea how to fix this in an Ionic/Cordova project.

What can I do to solve this problem?

CodePudding user response:

I solved it.

There was a wrong package name in MainActivity. After removing the Android platform and adding it again the package name was correct. And after a build the starts again.

  • Related