从19开始将minSdkVersion的值更新为21后开始出现此错误。它仅在5.0设备上发生,OS 6+的设备正常工作
应用程序包含所有multidex属性。同样如谷歌所建议的那样,如果minSdkVersion为21,则不需要multidex,但这也会引发类似的错误。
尝试清理项目,缓存等
尝试禁用即时运行但到目前为止没有运气。
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/agent/android/instrumentation/GsonInstrumentation;
at com.demo.app.persistence.Datastore.getMember(Datastore.java:142)
at com.demo.app.Application.initDatastore(Application.java:139)
at com.demo.app.Application.onCreate(Application.java:84)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
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 "com.newrelic.agent.android.instrumentation.GsonInstrumentation" on path: DexPathList[[zip file "/data/app/com.demo.apptracker-1/base.apk"],nativeLibraryDirectories=[/data/app/com.babycenter.pregnancytracker-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.demo.app.persistence.Datastore.getMember(Datastore.java:142)
at com.demo.app.Application.initDatastore(Application.java:139)
at com.demo.app.Application.onCreate(Application.java:84)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5010)
at android.app.ActivityThread.access$1600(ActivityThread.java:172)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5835)
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: com.newrelic.agent.android.instrumentation.GsonInstrumentation
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)
... 15 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available