How to solve: I am getting error while running my flutter app

Question

Asked by Romanch h on December 03, 2021 (source).

When I am starting debugging I get this error :

Launching lib\main.dart on ONEPLUS A5000 in debug mode... lib\main.dart:1 E/AndroidRuntime(11211): in writeCrashedAppName, pkgName :com.new.package.azabazar E/AndroidRuntime(11211): FATAL EXCEPTION: main E/AndroidRuntime(11211): Process: com.new.package.azabazar, PID: 11211 E/AndroidRuntime(11211): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.new.package.azabazar/com.example.myapp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.myapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.new.package.azabazar-1/base.apk"],nativeLibraryDirectories=[/data/app/com.new.package.azabazar-1/lib/x86, /data/app/com.new.package.azabazar-1/base.apk!/lib/x86, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]] E/AndroidRuntime(11211): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2570) E/AndroidRuntime(11211): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729) E/AndroidRuntime(11211): at android.app.ActivityThread.-wrap12(ActivityThread.java) E/AndroidRuntime(11211): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480) E/AndroidRuntime(11211): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(11211): at android.os.Looper.loop(Looper.java:154) E/AndroidRuntime(11211): at android.app.ActivityThread.main(ActivityThread.java:6138) E/AndroidRuntime(11211): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(11211): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:893) E/AndroidRuntime(11211): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:783) E/AndroidRuntime(11211): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.myapp.MainActivity" on path: DexPathList[[zip file "/data/app/com.new.package.azabazar-1/base.apk"],nativeLibraryDirectories=[/data/app/com.new.package.azabazar-1/lib/x86, /data/app/com.new.package.azabazar-1/base.apk!/lib/x86, /system/lib, /vendor/lib, /data/downloads, /data/priv-downloads]] E/AndroidRuntime(11211): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) E/AndroidRuntime(11211): at java.lang.ClassLoader.loadClass(ClassLoader.java:380) E/AndroidRuntime(11211): at java.lang.ClassLoader.loadClass(ClassLoader.java:312) E/AndroidRuntime(11211): at android.app.Instrumentation.newActivity(Instrumentation.java:1108) E/AndroidRuntime(11211): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2560) E/AndroidRuntime(11211): ... 9 more

Answer

Question answered by RomJan D (source).

You should delete

android/
ios/
build/
web/ 

Those folders.

Then run flutter create .

Then change package name by running flutter pub run change_app_package_name:main com.company.azabazar

this might solve your prob :)

ANDROID BUILDING DART FLUTTER RUNTIME-ERROR
SHARE: