关于闪退的问题
就这次作业我在小米2上(L版本,应该是5.1)的系统上可以正常运行。后来试了一下,在小米6和三星上都是直接闪退(N版本),但是我检查了gradle 25应该是N版本呀。代码也很简单。为啥会有闪退
在小米6上抓到的applog在如下,很奇怪为什么会找不到类,想了很多办法都不奏效。
06-03 06:05:19.576 3429 3429 E AndroidRuntime: FATAL EXCEPTION: main
06-03 06:05:19.576 3429 3429 E AndroidRuntime: Process: imooc.com.imooc_demo, PID: 3429
06-03 06:05:19.576 3429 3429 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{imooc.com.imooc_demo/imooc.com.imooc_demo.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "imooc.com.imooc_demo.MainActivity" on path: DexPathList[[zip file "/data/app/imooc.com.imooc_demo-1/base.apk"],nativeLibraryDirectories=[/data/app/imooc.com.imooc_demo-1/lib/arm64, /system/lib64, /vendor/lib64]]
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2582)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2741)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1490)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6165)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:785)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "imooc.com.imooc_demo.MainActivity" on path: DexPathList[[zip file "/data/app/imooc.com.imooc_demo-1/base.apk"],nativeLibraryDirectories=[/data/app/imooc.com.imooc_demo-1/lib/arm64, /system/lib64, /vendor/lib64]]
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
06-03 06:05:19.576 3429 3429 E AndroidRuntime: ... 9 more
正在回答
你编一个特别简单的代码试一试呢,就有个TexeView的,先确定是不是版本问题
- 参与学习 人
- 提交作业 5461 份
- 解答问题 7238 个
此次推出的专题为Android攻城狮培养计划的第一部分语法与界面基础篇,将带大家从0开始学习Android开发。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星