Dagger2 androidTest error duplicate entry: javax / annotation / Generated.class

I am using Dagger2 for DI. My project has 2 modules, a module :common, which is a library, and a module :app, which is the actual application.

In the library module, I have AndroidAppone that extends MultiDexApplicationand inherits in the module :app. I added a Google dagger2 example to add DI with Dagger2.

Every time I run the application, I get the following message as an error:

Android/common/src/main/java/com/common/AndroidApp.java:10: The import com.common.di.DaggerAndroidAppComponent cannot be resolved.

but the weird part is what Android Studio says BUILD SUCESSFULLand the application works without problems.

When I try to run tests (androidTest) in the library module :common, I get the following error:

Error:Execution failed for task ':common:packageAllDebugAndroidTestClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: javax/annotation/Generated.class

I assume there is no connection between the two errors, but can anyone understand what is happening and how to fix the tests?

+4
source share
1 answer

After updating the gradle plugin to version 1.2.3, the problems stopped showing up. Weird

0
source

Source: https://habr.com/ru/post/1585073/


All Articles