I'm having issues with my mainActivity when i run my flutter app

816 views Asked by At

Heyy there

When i try running my flutter app on andriod is give me the flollowing error on my termninal

E/AndroidRuntime(10355): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.robyhub.admin/com.robyhub.admin.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10355): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3551) E/AndroidRuntime(10355): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782) E/AndroidRuntime(10355): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) E/AndroidRuntime(10355): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime(10355): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime(10355): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) E/AndroidRuntime(10355): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(10355): at android.os.Looper.loopOnce(Looper.java:201) E/AndroidRuntime(10355): at android.os.Looper.loop(Looper.java:288) E/AndroidRuntime(10355): at android.app.ActivityThread.main(ActivityThread.java:7872) E/AndroidRuntime(10355): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(10355): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E/AndroidRuntime(10355): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) E/AndroidRuntime(10355): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10355): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) E/AndroidRuntime(10355): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime(10355): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(10355): at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95) E/AndroidRuntime(10355): at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45) E/AndroidRuntime(10355): at android.app.Instrumentation.newActivity(Instrumentation.java:1339) E/AndroidRuntime(10355): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538) E/AndroidRuntime(10355): ... 12 more E/AndroidRuntime(10460): FATAL EXCEPTION: main E/AndroidRuntime(10460): Process: com.robyhub.admin, PID: 10460 E/AndroidRuntime(10460): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.robyhub.admin/com.robyhub.admin.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3551) E/AndroidRuntime(10460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3782) E/AndroidRuntime(10460): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) E/AndroidRuntime(10460): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) E/AndroidRuntime(10460): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) E/AndroidRuntime(10460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307) E/AndroidRuntime(10460): at android.os.Handler.dispatchMessage(Handler.java:106) E/AndroidRuntime(10460): at android.os.Looper.loopOnce(Looper.java:201) E/AndroidRuntime(10460): at android.os.Looper.loop(Looper.java:288) E/AndroidRuntime(10460): at android.app.ActivityThread.main(ActivityThread.java:7872) E/AndroidRuntime(10460): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(10460): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) E/AndroidRuntime(10460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) E/AndroidRuntime(10460): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.robyhub.admin.MainActivity" on path: DexPathList[[zip file "/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/lib/x86_64, /data/app/~~J4C_87wa30Rj27UdvoVjgQ==/com.robyhub.admin-MzOJ1FR3nuDtfhupLYb-ZQ==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(10460): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) E/AndroidRuntime(10460): at java.lang.ClassLoader.loadClass(ClassLoader.java:379) E/AndroidRuntime(10460): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(10460): at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95) E/AndroidRuntime(10460): at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45) E/AndroidRuntime(10460): at android.app.Instrumentation.newActivity(Instrumentation.java:1339) E/AndroidRuntime(10460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3538) E/AndroidRuntime(10460): ... 12 more

I have tried flutter clean and flutter build but no luck so far.

Please what can i do?

2

There are 2 answers

0
Wladimir Sichinski On

It appears that Flutter is unable to find the main activity of your app. This could be due to a number of issues, including a misconfigured manifest or the main activity not being declared correctly in the manifest.

It is also possible that you have an issue with your build configuration. Check your build.gradle file and make sure that the main activity is correctly declared as the launcher activity.

You should also check the AndroidManifest.xml file to make sure that the main activity is correctly declared there. If everything looks correct but the issue persists, you may need to perform a flutter clean to clear any cached build files.

If you are still having issues, you may want to try running the app in an emulator or on a different device to determine if the issue is isolated to a particular device. It is also possible that the issue is caused by a bug in the version of Flutter you are using. If this is the case, you may need to upgrade to a newer version of Flutter.

0
Tonny Anthony On

I had the same problem after changing my package. Please ensure the package name has been changed in the manifest file. Importantly, go to the android folder, then the app folder, and then the main folder; make the kotlin folder structure reflect the new package name structure