Dagger2 androidTest错误重复条目:javax / annotation / Generated.class [英] Dagger2 androidTest error duplicate entry: javax/annotation/Generated.class
问题描述
我将Dagger2用于DI。我的项目有2个模块,一个:common
模块是一个库,一个:app
模块是实际的应用程序。
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.
在库模块中,我有 AndroidApp
,它扩展了 MultiDexApplication
并在:app
模块中继承。我已按照Google的dagger2 示例的要求,使用Dagger2添加DI 。
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.
但奇怪的是Android Studio说 BUILD SUCESSFULL
,应用程序运行就没有问题。
but the weird part is that Android Studio says BUILD SUCESSFULL
and the app runs without problems.
当我尝试在:common
库模块我收到以下错误:
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?
推荐答案
将gradle插件更新为1.2.3之后,问题不再出现。奇怪。
After I updated the gradle plugin to 1.2.3 the issues stopped showing up. Weird.
这篇关于Dagger2 androidTest错误重复条目:javax / annotation / Generated.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!