我的应用程序在模拟器中运行良好,甚至在 android studio 安装的用于调试目的的真实设备中运行良好,但如果使用 apk 文件手动安装,它会崩溃.
My Application is running fine in Emulators and even in real devices installed by android studio for debugging purpose, but it is crashing if installed manually using apk file.
如果需要,我准备粘贴任何其他代码,例如 Activity.
I am ready to paste any other codes, like Activity if required.
这里是日志:
04-14 12:20:44.392 6220-6220/? I/art: Late-enabling -Xcheck:jni
04-14 12:20:44.465 6220-6220/test.planner W/System: ClassLoader referenced unknown path: /data/app/test.planner-1/lib/arm
04-14 12:20:44.467 6220-6220/test.planner I/InstantRun: starting instant run server: is main process
04-14 12:20:44.470 6220-6220/test.planner D/AndroidRuntime: Shutting down VM
04-14 12:20:44.471 6220-6220/test.planner E/AndroidRuntime: FATAL EXCEPTION: main
Process: test.planner, PID: 6220
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{test.planner/test.planner.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "test.planner.MainActivity" on path: DexPathList[[zip file "/data/app/test.planner-1/base.apk"],nativeLibraryDirectories=[/data/app/test.planner-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "test.planner.MainActivity" on path: DexPathList[[zip file "/data/app/test.planner-1/base.apk"],nativeLibraryDirectories=[/data/app/test.planner-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Suppressed: java.lang.ClassNotFoundException: test.planner.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
去:
Android Studio --> File --> Setting --> Build, execution, deploy --> Instant run.
并禁用即时运行
.
这篇关于如果手动安装 apk,Android 应用程序在真实设备上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!