react-native-fcm: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzqf;
Hi, @evollu !
i want help to guys to fix this issue with multiple dex ,etc.
really working solution is forking needed repos, and change dependency versions in build.gradle at /node_modules/{NAME_LIB}/android/build.gradle, to bring to one appearence
e.g, in my project i need react-native-fcm@2.5.6 and react-native-maps@0.12.1 in maps lib build.gradle was set:
compile “com.google.android.gms:play-services-base:9.8.0” compile “com.google.android.gms:play-services-maps:9.8.0”
and in fcm:
compile ‘com.google.firebase:firebase-core:+’ compile ‘com.google.firebase:firebase-messaging:+’
so that we need change build.gradle file our fcm lib so that it looks as follows, and error will disappear=)
compile ‘com.google.firebase:firebase-core:9.8.0’ compile ‘com.google.firebase:firebase-messaging:9.8.0’
add this ad README.md file, for someone it may be useful) thank you
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (2 by maintainers)
I write whole article about this problem: https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f#.9l0u84y9t
Hope I helped you 😃
I had this problem, and this was my solution: Add compile ‘com.google.android.gms:play-services-gcm:+’ to the dependeencies in /node_modules/react-native-fcm/android/build.gradle
Im not experinced in Android, but seems to me that if we configure the version of that library in the build.gradle of the app, it will create conflict with other existent modules that has already that library as a dependence, perhaps with different version. To avoid that, I added the dependence in the build.gradle of the module itself, and now every module works with the version it needs.
(This is my own interpretation, may be wrong but the fix worked for me… I hope it helps you… Cheers!!)