evollu / react-native-firebase-analytics

React native bridge for firebase analytics
MIT License
206 stars 54 forks source link

Multiple dex files define Lcom/google/firebase/FirebaseException; #57

Open vennassafir opened 7 years ago

vennassafir commented 7 years ago

Hi,

I can't build app when I add to this line on project/android/app/build.gradle

apply plugin: "com.android.application" //apply plugin: 'com.google.gms.google-services' // <-This line Add this line for analytics import com.android.build.OutputFile

ERROR;

FAILURE: Build failed with an exception.

Please help me, Thanks

mienaikoe commented 7 years ago

I got this exception a couple of times too. The problem usually happens when you're using different versions of play services and firebase. What I've found to work is called a version resolution in gradle:

In android/app/build.gradle: at this line:

compile project(':react-native-firebase-analytics')

transform this into:

compile( project(':react-native-firebase-analytics') ){
  exclude group: 'com.google.firebase'
}

Then below that add this:

compile ("com.google.android.gms:play-services-base:10.0.1") {
    force = true;
}
compile ('com.google.firebase:firebase-core:10.0.1') {
    force = true;
}

**make sure that if you're using react-native-fcm, that you resolve firebase-messaging this way as well. Every firebase and play-services library that you're using should be using the same version.

Haideralee commented 7 years ago

Project with path ':react-native-firebase-analytics:10.0.1' could not be found in project