java.lang.NoClassDefFoundError:失败的解决方案

时间:2017-08-11 01:51:07

标签: android classnotfoundexception

  

我在android studio上安装了jrebel for android,这个错误发生在启动时

     

这是我的配置:

     

我的jdk版本:jdk1.8.0_91

     

compileSdkVersion 24

     

buildToolsVersion" 25.0.0"

     

classpath' com.android.tools.build:gradle:2.3.3

     

有谁知道为什么?

08-11 09:25:24.025 net.wds.wisdomcampus E/AndroidRuntime: FATAL EXCEPTION: main
                                                      Process: net.wds.wisdomcampus, PID: 16747
                                                      java.lang.NoClassDefFoundError: Failed resolution of: Lnet/wds/wisdomcampus/utils/SharedPreferenceUtils;
                                                          at net.wds.wisdomcampus.activity.SplashActivity.onCreate(SplashActivity.java:23)
                                                          at android.app.Activity.performCreate(Activity.java:6289)
                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                          at cn.jiguang.a.a.c.a.a.d.callActivityOnCreate(Unknown Source)
                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
                                                          at android.app.ActivityThread.access$900(ActivityThread.java:177)
                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                          at android.os.Looper.loop(Looper.java:145)
                                                          at android.app.ActivityThread.main(ActivityThread.java:5951)
                                                          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:1399)
                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
                                                       Caused by: java.lang.ClassNotFoundException: Didn't find class "net.wds.wisdomcampus.utils.SharedPreferenceUtils" on path: DexPathList[[zip file "/data/app/net.wds.wisdomcampus-1/base.apk"],nativeLibraryDirectories=[/data/app/net.wds.wisdomcampus-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 com.zeroturnaround.jrebel.android.runtime.fV.loadFromParent(SourceFile:110)
                                                          at com.zeroturnaround.jrebel.android.runtime.fV.loadClass(SourceFile:94)
                                                          at net.wds.wisdomcampus.activity.SplashActivity.onCreate(SplashActivity.java:23) 
                                                          at android.app.Activity.performCreate(Activity.java:6289) 
                                                          at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
                                                          at cn.jiguang.a.a.c.a.a.d.callActivityOnCreate(Unknown Source) 
                                                          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655) 
                                                          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767) 
                                                          at android.app.ActivityThread.access$900(ActivityThread.java:177) 
                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449) 
                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                          at android.os.Looper.loop(Looper.java:145) 
                                                          at android.app.ActivityThread.main(ActivityThread.java:5951) 
                                                          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:1399) 
                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) 
                                                        Suppressed: java.lang.ClassNotFoundException: net.wds.wisdomcampus.utils.SharedPreferenceUtils
                                                          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)
                                                                ... 18 more
                                                       Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

1 个答案:

答案 0 :(得分:0)

请查看以下主题。这将解决您的问题

Android: ClassNotFoundException while class is present

您正在使用设备版本< 21

遇到Multidex问题