我正在尝试使用两个使用GCM和FCM的插件。但是当我尝试构建项目时,它失败并出现以下错误:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/actions/ItemListIntents;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
>
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/home/karan/jdk1.8.0_91/bin/java'' finished with non-zero exit value 2
我知道为什么"多个dex文件定义"发生错误,这是因为当两个插件需要相同的依赖项时。但是因为插件是第三方所以如何在我的最终解决这个错误。请帮我弄清楚这种情况。
PS:有人将此问题标记为Android studio 2.0 gradle transformClassesWithDexForDebug fails when using button "run"帖子的副本。但我想要一个不是Android Studio的手机解决方案。 :)
由于
答案 0 :(得分:0)
这与Android Studio完全无关!
所述依赖关系是:
From Realtime Framework
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
and
From hotline-phonegap
compile 'com.android.support:appcompat-v7:22.2.1'
您可以手动编辑这些依赖项以相互匹配。您可能需要更改这些库的相关Android平台代码。由于它们是来自单独维护者的单独项目,因此这似乎是你最好的镜头。