skip to Main Content

I was working on my flutter project but after setting up the firebase I got this error message
Launching libmain.dart on sdk gphone64 x86 64 in debug mode…
Running Gradle task ‘assembleDebug’…
√ Built buildappoutputsflutter-apkapp-debug.apk.
E/AndroidRuntime(11067): FATAL EXCEPTION: main
E/AndroidRuntime(11067): Process: com.momo.momo_app, PID: 11067
E/AndroidRuntime(11067): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.momo.momo_app/com.momo.momo_app.MainActivity}: java.lang.ClassNotFoundException: Didn’t find class "com.momo.momo_app.MainActivity" on path: DexPathList[[zip file "/data/app/~~-FM0XVr5pYkMef405Eq6pA==/com.momo.momo_app-213V8aIgRZ5LjJmlwi3P1A==/base.apk"],nativeLibraryDirectories=[/data/app/~~-FM0XVr5pYkMef405Eq6pA==/com.momo.momo_app-213V8aIgRZ5LjJmlwi3P1A==/lib/x86_64, /data/app/~~-FM0XVr5pYkMef405Eq6pA==/com.momo.momo_app-213V8aIgRZ5LjJmlwi3P1A==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(11067): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3545)
E/AndroidRuntime(11067): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792)
E/AndroidRuntime(11067): at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
E/AndroidRuntime(11067): at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
E/AndroidRuntime(11067): at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
E/AndroidRuntime(11067): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
E/AndroidRuntime(11067): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(11067): at android.os.Looper.loopOnce(Looper.java:201)
E/AndroidRuntime(11067): at android.os.Looper.loop(Looper.java:288)
E/AndroidRuntime(11067): at android.app.ActivityThread.main(ActivityThread.java:7839)
E/AndroidRuntime(11067): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(11067): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/AndroidRuntime(11067): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
E/AndroidRuntime(11067): Caused by: java.lang.ClassNotFoundException: Didn’t find class "com.momo.momo_app.MainActivity" on path: DexPathList[[zip file "/data/app/~~-FM0XVr5pYkMef405Eq6pA==/com.momo.momo_app-213V8aIgRZ5LjJmlwi3P1A==/base.apk"],nativeLibraryDirectories=[/data/app/~~-FM0XVr5pYkMef405Eq6pA==/com.momo.momo_app-213V8aIgRZ5LjJmlwi3P1A==/lib/x86_64, /data/app/~~-FM0XVr5pYkMef405Eq6pA==/com.momo.momo_app-213V8aIgRZ5LjJmlwi3P1A==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]] E/AndroidRuntime(11067): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
E/AndroidRuntime(11067): at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(11067): at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(11067): at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
E/AndroidRuntime(11067): at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
E/AndroidRuntime(11067): at android.app.Instrumentation.newActivity(Instrumentation.java:1273)
E/AndroidRuntime(11067): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3532)
E/AndroidRuntime(11067): … 12 more

I’ve taken the following troubleshooting steps to address the issue of my Flutter app crashing with the "java.lang.RuntimeException" error

I carefully verified that the package name specified in my Flutter app’s AndroidManifest.xml, Gradle files, and source code matches consistently and I ran the flutter clean command to remove cached build files and then rebuilt the project using flutter build followed by flutter run. My expectation was that this would eliminate any potential issues caused by cached files.

2

Answers


  1. Chosen as BEST ANSWER

    here is my the file structure of the android folder stucture of android folder

    And here is the the code In MainActivity MainActivity Code


  2. Can you give a screenshot of your file structure of android folder?
    And also provide the code in MainActivity

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search