0

I am trying to use two plugins which use GCM and FCM. But when I try to build the project it failed with following error:

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

I know why "Multiple dex files define" error occurs, this is because when two plugin require same dependencies. But as plugins are third party so how to resolve this error on my end. Please help me to figure out this situation.

PS: Somebody marked this question as duplicate of Android studio 2.0 gradle transformClassesWithDexForDebug fails when using button "run" post. But I want a phonegap solution not Android Studio. :)

Thanks

Community
  • 1
  • 1

1 Answers1

0

This is not related to Android Studio at all!

Said dependencies are:

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'

You can manually edit those dependencies to match with each other. You might need to change related Android platform codes for those libraries. Since they are seperate projects from seperate maintainers this seems like your best shot.

  • Its cordova push plugin: https://github.com/realtime-framework/CordovaPush and Hotline https://github.com/freshdesk/hotline-phonegap. – Karan S. Sisodia Jun 21 '16 at 13:18