问题
I'm using Dagger2 for DI. My project has 2 modules, a :common
module which is a library and an :app
module which is the actual application.
In the library module I have AndroidApp
which extends MultiDexApplication
and is inherited in :app
module. I have followed Google's dagger2 example to add DI with Dagger2.
Each time I run the app 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 that Android Studio says BUILD SUCESSFULL
and the app runs without problems.
When I try to run tests (androidTest) on the :common
library module I get the following error:
Error:Execution failed for task ':common:packageAllDebugAndroidTestClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: javax/annotation/Generated.class
I'm assuming there is no connection between these 2 errors, but does anyone have any idea on what's going on and how to fix the tests?
回答1:
After I updated the gradle plugin to 1.2.3 the issues stopped showing up. Weird.
来源:https://stackoverflow.com/questions/29915107/dagger2-androidtest-error-duplicate-entry-javax-annotation-generated-class