如何解决重复条目重复条目:javax/annotation/ParametersAreNullableByDefault.class

Ken*_*Ken 6 android gradle cordova android-studio crosswalk-runtime

我是Gradle构建系统和Android Studio的新手,并不能完全弄清楚如何解决这个问题.我的构建失败了:

  * What went wrong:
  Execution failed for task ':cyanEngine:packageAllDebugClassesForMultiDex'.
  > java.util.zip.ZipException: duplicate entry:      javax/annotation/ParametersAreNullableByDefault.class
Run Code Online (Sandbox Code Playgroud)

如果我执行Ctrl+ N并搜索ParametersAreNullableByDefault.一个参考指向外部库 | jsr305-1.3.9.另一种是指向classes.jarxwalk_core_library.

xwalk_core_library在我的xwalk_cordova模块中通过以下方式引用:

{
  android{
    dependencies{
        compile 'org.xwalk:xwalk_core_library:11.40.277.7'
    }
}
Run Code Online (Sandbox Code Playgroud)

我的应用程序的gradle依赖项有:

compile project (':xwalk_cordova')
Run Code Online (Sandbox Code Playgroud)

好像我需要摆脱外部图书馆,但我不知道它来自哪里.

有关如何解决此问题的任何指示?

更新: 我发现外部引用来自Guava,在应用程序build.gradle via中引用compile ('com.google.guava:guava:11.0.2').刚刚更新到Guava版本18.0似乎让我现在已经过了这个.猜猜新版本不再依赖于jsr.

不过,我觉得我会再遇到这个问题.基本上,我们有两个第三方库,具体取决于相同的库.什么是清理它的最佳方法?

我注意到对于robolectic,有一个排除,我猜是出于类似的原因:

testCompile('org.robolectric:robolectric:3.0-rc2') {
    exclude group: 'commons-logging', module: 'commons-logging'
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
Run Code Online (Sandbox Code Playgroud)

我很好奇这个陈述是如何工作的,并且不太了解Gradle文档.这句话是什么意思?'group'和'module'来自哪里?