0

I recently upgraded flutter to 1.2 and on testing it on a real device it ends up crashing. Here's is the error it throws on the debug console:

E/AndroidRuntime(21890): FATAL EXCEPTION: main
E/AndroidRuntime(21890): Process: com.example.instagram_clone, PID: 21890
E/AndroidRuntime(21890): java.lang.RuntimeException: Unable to instantiate application io.flutter.app.FlutterApplication: java.lang.ClassNotFoundException: Didn't find class "io.flutter.app.FlutterApplication" on path: DexPathList[[zip file "/data/app/com.example.instagram_clone-Z7ozUBGogMCjxOJ-rLwCOQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.instagram_clone-Z7ozUBGogMCjxOJ-rLwCOQ==/lib/arm, /system/lib, /vendor/lib]]
E/AndroidRuntime(21890):    at android.app.LoadedApk.makeApplication(LoadedApk.java:999)
E/AndroidRuntime(21890):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5742)
E/AndroidRuntime(21890):    at android.app.ActivityThread.-wrap1(Unknown Source:0)
E/AndroidRuntime(21890):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1680)
E/AndroidRuntime(21890):    at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(21890):    at android.os.Looper.loop(Looper.java:164)
E/AndroidRuntime(21890):    at android.app.ActivityThread.main(ActivityThread.java:6523)
E/AndroidRuntime(21890):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21890):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
E/AndroidRuntime(21890):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
E/AndroidRuntime(21890): Caused by: java.lang.ClassNotFoundException: Didn't find class "io.flutter.app.FlutterApplication" on path: DexPathList[[zip file "/data/app/com.example.instagram_clone-Z7ozUBGogMCjxOJ-rLwCOQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.instagram_clone-Z7ozUBGogMCjxOJ-rLwCOQ==/lib/arm, /system/lib, /vendor/lib]]
E/AndroidRuntime(21890):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
E/AndroidRuntime(21890):    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
E/AndroidRuntime(21890):    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
E/AndroidRuntime(21890):    at android.app.Instrumentation.newApplication(Instrumentation.java:1087)
E/AndroidRuntime(21890):    at android.app.LoadedApk.makeApplication(LoadedApk.java:993)
E/AndroidRuntime(21890):    ... 9 more

Any help will be appreciated. I also ran flutter upgrade , flutter pub get and flutter clean. I am testing the app on a real device and it worked before i upgraded.

3
  • Can you confirm if you have MainActivity.java or MainActivity.kt with the proper class declaration? Commented Aug 9, 2020 at 16:36
  • Yes i have all. Commented Aug 12, 2020 at 13:58
  • just make sure the package name on mainactivity.java or mainactivity.kt is correct Commented Apr 1, 2021 at 9:11

4 Answers 4

3

Same issue. The reason I found is that I changed the package name in the AndroidManifest.xml files at Main, debug and profile in Android --> App.

Solved the issue by changing the Package name with the new one in MainActivity.Kt

Sign up to request clarification or add additional context in comments.

Comments

1

I changed com.example.myapp to match what I had used to set up firebase under myapp --> android --> app --> main --> kotlin --> myapp --> MainActivity.kt

1 Comment

did you changed the folder names ?
0

I managed to solve the problem by starting another project and copying lib file,pubspec.yaml and/or assets folder to the new project. Unfotunately i had to reconnect to firebase/or any other backend all over again.

Comments

-1

me too thats the only way , I started brand new project. copied Everything again ...had to do allot of changes. (3 times ) all backend again , all manifest build.gradle, podfile, info.plist and ALL that again however the easiest way a little faster... of your bundle is : com.domain.coolapp flutter create coolapp --org com.domain it some other location where the coolapp folder can be created without conflict...for me this happens when the location services (geolocator , location and such ). get funny and just crashes the app like crazy. also had to do this >adb shell , pm uninstall com.domain.coolapp, exit

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.