运行 我的 flutter 应用程序出现错误
I am getting error while running my flutter app
当我开始调试时出现此错误:
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
你应该删除
android/
ios/
build/
web/
那些文件夹。
然后运行flutter create .
然后运行ningflutter pub run change_app_package_name:main com.company.azabazar
修改包名
这可能会解决您的问题:)
当我开始调试时出现此错误:
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
你应该删除
android/
ios/
build/
web/
那些文件夹。
然后运行flutter create .
然后运行ningflutter pub run change_app_package_name:main com.company.azabazar
这可能会解决您的问题:)