Error when generating code coverage report for androidTest instrumented testcases with dagger

狂风中的少年 提交于 2020-01-06 17:58:25

问题


I want to run createDebugCoverageReport gradle task.But after run task is failing and giving below error.

 java.lang.NoClassDefFoundError: dagger.shaded.auto.common.BasicAnnotationProcessor
  at java.lang.Class.classForName(Native Method)
  at java.lang.Class.forName(Class.java:324)
  at android.support.test.internal.runner.TestLoader.doLoadClass(TestLoader.java:92)
  at android.support.test.internal.runner.TestLoader.loadIfTest(TestLoader.java:113)
  at android.support.test.internal.runner.TestRequestBuilder.loadClassesFromClassPath(TestRequestBuilder.java:801)
  at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:747)
  at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:354)
  at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:260)
   at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1970)

Below are the dagger dependencies used

 compile 'com.google.dagger:dagger:2.4'
 annotationProcessor 'com.google.dagger:dagger-compiler:2.4'
 androidTestCompile 'com.google.dagger:dagger-compiler:2.4'

Please suggest, How I can remove this error.


回答1:


due what I found, it's a conflict with dagger-producers extensions - auto-value-gson works fine with dagger 2.0.2 - 2.4, but when dagger-producers (any version) is added as extra dependency to project following exception is thrown.

our problem is you are hitting the dex limit, which is different than this ticket. Make sure you're adding those dependencies to the apt config, not compile.



来源:https://stackoverflow.com/questions/42714259/error-when-generating-code-coverage-report-for-androidtest-instrumented-testcase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!