android studio用数据线真机调试,5.0一下的版本一切正常。5.0开始就会报错,居然报ClassNotFoundException,我也是无语了。但是如果在5.0一下run之后生成的apk包可以在任何版本安装也不会报错。是不是5.0开始调试有一些特别的地方,大家有没有遇到过?求指点迷津
报错日志大致如下:其中xxx...用于隐藏真实项目包信息
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.xxxxx, PID: 22797
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.xxx.xxxxx/com.xxx.xxxx.reserve.XxxActivity}: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxxx.reserve.XxxActivity" on path: DexPathList[[zip file "/data/app/com.xxx.xxxxx-2/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxxxx-2/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2241)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
at android.app.ActivityThread.access$800(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5275)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxxx.reserve.XxxActivity" on path: DexPathList[[zip file "/data/app/com.xxx.xxxxx-2/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxxxx-2/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:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)?
at android.app.ActivityThread.access$800(ActivityThread.java:154)?
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1306)?
at android.os.Handler.dispatchMessage(Handler.java:102)?
at android.os.Looper.loop(Looper.java:135)?
at android.app.ActivityThread.main(ActivityThread.java:5275)?
at java.lang.reflect.Method.invoke(Native Method)?
at java.lang.reflect.Method.invoke(Method.java:372)?
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)?
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)?
Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxxx.reserve.XxxActivity" on path: DexPathList[[zip file "/data/data/com.xxx.xxxxx/app_curRes/BaiduNaviSDK_3.1.1.jar"],nativeLibraryDirectories=[/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:504)
... 13 more
Suppressed: java.lang.ClassNotFoundException: com.xxx.xxxx.reserve.XxxActivity
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)
... 14 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
感觉和instantrun有关。我的觉得也是,那要怎么解决呢?分包的问题吧一开始查了些资料有说到分包,我也做了分包处理,还是不行~我是没有遇到过,4.x,5.x都没啥问题
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。