Description:
I just implem react-native-onesignal and I had this error when I tried to build :
Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: com.google.android.gms.internal.zzcceFAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: {...}
I tried to fix it with google and issues already open here, but I didnt find the solution. (the EnableMultiDex : true doesn't work)
Environment
"react-native-onesignal": "^3.2.0"
This is my dependencies :
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(':tipsi-stripe')
implementation "com.facebook.react:react-native:+"
implementation (project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation (project(':react-native-camera')) {
exclude group: "com.google.android.gms"
exclude group: "com.android.support", module: 'support-v4'
}
implementation(project(':react-native-onesignal')) { exclude group: 'com.google.android.gms' }
implementation "com.android.support:appcompat-v7:23.0.1"
implementation 'com.google.android.gms:play-services-base:10.0.1'
implementation 'com.google.android.gms:play-services-maps:10.0.1'
}
Thank you really much
I noticed that if I'am adding this in my dependencies it build with success but the app crash directly when launched :
implementation 'com.google.android.gms:play-services-location:+'
@eQuinox-l Both the build error and the crash are due to a mixture of different Google Play services (gms) library versions in your project.
To fix the issue I recommend changing
implementation(project(':react-native-onesignal')) { exclude group: 'com.google.android.gms' }
TO:
implementation(project(':react-native-onesignal'))
And then follow the OneSignal-Gradle-Plugin guide to add this plugin to your project which aligns all versions of gms for you.
If you continue to see errors then make sure you don't have any com.google.android.gms or com.google.firebase at version 14 or higher. Including having + as a version as you noted above. Keeping the version under 14 is required currently since OneSignal-Gradle-Plugin does not support these higher versions yet.
Thank you really much.
implementation(project(':react-native-onesignal'))
Insert this line without the exclude wasn't enought ! The Guide did the trick !!
Closing because the issue has been resolved - If you (or anyone else) encounters this problem again please feel free to respond and we'll be happy to reopen and investigate the issue.
when i am added the cordova-plugin-google-analytics for ionic version 1. Then apk get crashed . So please somebody help me to out from it.
Most helpful comment
@eQuinox-l Both the build error and the crash are due to a mixture of different Google Play services (gms) library versions in your project.
To fix the issue I recommend changing
TO:
And then follow the OneSignal-Gradle-Plugin guide to add this plugin to your project which aligns all versions of gms for you.
If you continue to see errors then make sure you don't have any
com.google.android.gmsorcom.google.firebaseat version 14 or higher. Including having+as a version as you noted above. Keeping the version under 14 is required currently sinceOneSignal-Gradle-Plugindoes not support these higher versions yet.