它在应用程序中工作,但是当我运行检测测试时,我得到一个NoClassDefFoundError.
我正在使用Gradle和Espresso.没有progaurd就会发生这种情况.
这很奇怪,因为“Module $$ModuleAdapter”被加载,但“Module $$ModuleAdapter $EndpointProvIDesAdapter”却没有.
我将APK从设备中拉回来并使用dexdump验证该类确实在APK中,“Module $$ModuleAdapter $EndpointProvIDesAdapter”.
关于可能导致这种情况的任何想法?
java.lang.NoClassDefFoundError: Module$$ModuleAdapter$EndpointProvIDesAdapter at ...Module$$ModuleAdapter.getBindings(MslModule$$ModuleAdapter.java:33) at ...Module$$ModuleAdapter.getBindings(MslModule$$ModuleAdapter.java:13) at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:185) at dagger.ObjectGraph$DaggerObjectGraph.access解决方法 Double Espresso现已弃用,转而使用Espresso 2.0.它可能对你有用,因为Jake在枚举传递依赖关系方面做得很好,你可能需要排除这些依赖关系才能让事情发生.androIDTestCompile ('com.androID.support.test.espresso:espresso-core:2.0') { exclude group: 'javax.inject'}0(ObjectGraph.java:138) at dagger.ObjectGraph.create(ObjectGraph.java:129) at ...Application.onCreate(...Application.java:21) at androID.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007) at androID.app.ActivityThread.handleBindApplication(ActivityThread.java:4344) at androID.app.ActivityThread.access00(ActivityThread.java:135) at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) at androID.os.Handler.dispatchMessage(Handler.java:102) at androID.os.Looper.loop(Looper.java:136) at androID.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.classNotFoundException: DIDn't find class ...Module$$ModuleAdapter$MslEndpointProvIDesAdapter" on path: DexPathList[[zip file "/system/framework/androID.test.runner.jar",zip file "/data/app/....test-1.apk",zip file "/data/app/...-2.apk"],nativelibraryDirectorIEs=[/data/app-lib/....test-1,/data/app-lib/...-2,/vendor/lib,/system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.classLoader.loadClass(ClassLoader.java:497) at java.lang.classLoader.loadClass(ClassLoader.java:457)at ...Module$$ModuleAdapter.getBindings(MslModule$$ModuleAdapter.java:33)at ...Module$$ModuleAdapter.getBindings(MslModule$$ModuleAdapter.java:13)at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:185)at dagger.ObjectGraph$DaggerObjectGraph.access0(ObjectGraph.java:138)at dagger.ObjectGraph.create(ObjectGraph.java:129)at ...eApplication.onCreate(...Application.java:21)at androID.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)at androID.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)at androID.app.ActivityThread.access00(ActivityThread.java:135)at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)at androID.os.Handler.dispatchMessage(Handler.java:102)at androID.os.Looper.loop(Looper.java:136)at androID.app.ActivityThread.main(ActivityThread.java:5017)
根据我的经验,使用带有Dagger的Espresso 2.0可能需要您从espresso依赖项中排除javax.inject:
您可能需要对项目包含的所有espresso依赖项执行此 *** 作.
总结以上是内存溢出为你收集整理的在Android检测测试中给出NoClassDefFoundError的Dagger代码,但在普通应用程序中有效全部内容,希望文章能够帮你解决在Android检测测试中给出NoClassDefFoundError的Dagger代码,但在普通应用程序中有效所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)