Possible conflict with react-native-firebase

Hi, thanks for a great module 🙂

I have react-native-firebase working, and when I add react-native-device-info, I get the below error when running ‘gradlew.bat installDebug’ – any advice on how to get it working?

Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzbaz;

Misc info:

compileSdkVersion 23
buildToolsVersion "23.0.2"
minSdkVersion 16
targetSdkVersion 23
android/build.gradle dependencies:
  classpath 'com.android.tools.build:gradle:2.2.3'
  classpath 'com.google.gms:google-services:3.0.0'

3 thoughts on “Possible conflict with react-native-firebase

  1. I have trouble with start an app on the android device. Build is success.

    adb logcat:

    07-06 19:55:58.154  1678  2225 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.my.app.sa/.MainActivity bnds=[24,239][230,517] (has extras)} from uid 10021 on display 0
    07-06 19:55:58.161  1419  1441 W audio_hw_generic: Not supplying enough data to HAL, expected position 839800 , only wrote 839520
    07-06 19:55:58.169  3837  3837 I art     : Not late-enabling -Xcheck:jni (already on)
    07-06 19:55:58.170  3837  3837 W art     : Unexpected CPU variant for X86 using defaults: x86
    07-06 19:55:58.177  1678  1984 I ActivityManager: Start proc 3837:com.my.app.sa/u0a86 for activity com.my.app.sa/.MainActivity
    07-06 19:55:58.204  3837  3837 D AndroidRuntime: Shutting down VM
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: FATAL EXCEPTION: main
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: Process: com.my.app.sa, PID: 3837
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzbr; or its super classes (declaration of 'com.google.android.gms.common.internal.zzbr' appears in /data/app/com.my.app.sa-2/base.apk)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.-wrap2(ActivityThread.java)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:102)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6119)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
    07-06 19:55:58.207  1678  1689 W ActivityManager:   Force finishing activity com.my.app.sa/.MainActivity
    07-06 19:55:58.268  2270  2270 W SearchService: Abort, client detached.
    07-06 19:55:58.281  1678  3452 I OpenGLRenderer: Initialized EGL, version 1.4
    07-06 19:55:58.281  1678  3452 D OpenGLRenderer: Swap behavior 1
    07-06 19:55:58.281  1678  3452 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    07-06 19:55:58.281  1678  3452 D OpenGLRenderer: Swap behavior 0
    07-06 19:55:58.282  1678  3452 D EGL_emulation: eglCreateContext: 0xaef87040: maj 2 min 0 rcv 2
    07-06 19:55:58.286  1678  3452 D EGL_emulation: eglMakeCurrent: 0xaef87040: ver 2 0 (tinfo 0x907fffb0)
    07-06 19:55:58.295  1678  3452 D EGL_emulation: eglMakeCurrent: 0xaef87040: ver 2 0 (tinfo 0x907fffb0)
    07-06 19:55:58.713  1678  1692 W ActivityManager: Activity pause timeout for ActivityRecord{e58df8d u0 com.my.app.sa/.MainActivity t7 f}
    07-06 19:55:58.723  1678  1692 I WindowManager: Failed to capture screenshot of Token{4025542 ActivityRecord{e58df8d u0 com.my.app.sa/.MainActivity t7 f}} appWin=Window{6ebdfcb u0 Starting com.my.app.sa} drawState=3
    

    IOS app is ok

  2. Based on @leethree ‘s comment, I worked around this with:

    dependencies {
        compile(project(':react-native-device-info')) {
            exclude group: 'com.google.android.gms', module: 'play-services-gcm'
        }
        compile(project(':react-native-firebase')) {
            transitive = false
        }
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:25.3.1"
        compile "com.google.firebase:firebase-core:11.4.2"
        compile "com.google.firebase:firebase-messaging:11.4.2"
        compile "com.google.android.gms:play-services-base:11.4.2"
        compile "com.google.android.gms:play-services-gcm:11.4.2"
        compile "com.facebook.react:react-native:+"  // From node_modules
    }
    

    The problem is caused by mixing Google Play Services dependencies.

    From react-native-device-info‘s gradle file (as a dependency, using + is arguably the best approach):

    dependencies {
        compile 'com.facebook.react:react-native:+'
        compile 'com.google.android.gms:play-services-gcm:+'
    }
    

    From react-native-firebase‘s gradle file (because they target a specific compatible version):

    buildscript {
      ext.firebaseVersion = '11.4.2'
      ...
    }
    ...
    dependencies {
      ...
      compile "com.google.android.gms:play-services-base:$firebaseVersion"
      ...
    }
    

Comments are closed.

Possible conflict with react-native-firebase

Hi, thanks for a great module 🙂

I have react-native-firebase working, and when I add react-native-device-info, I get the below error when running ‘gradlew.bat installDebug’ – any advice on how to get it working?

Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzbaz;

Misc info:

compileSdkVersion 23
buildToolsVersion "23.0.2"
minSdkVersion 16
targetSdkVersion 23
android/build.gradle dependencies:
  classpath 'com.android.tools.build:gradle:2.2.3'
  classpath 'com.google.gms:google-services:3.0.0'

6 thoughts on “Possible conflict with react-native-firebase

  1. I have trouble with start an app on the android device. Build is success.

    adb logcat:

    07-06 19:55:58.154  1678  2225 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.my.app.sa/.MainActivity bnds=[24,239][230,517] (has extras)} from uid 10021 on display 0
    07-06 19:55:58.161  1419  1441 W audio_hw_generic: Not supplying enough data to HAL, expected position 839800 , only wrote 839520
    07-06 19:55:58.169  3837  3837 I art     : Not late-enabling -Xcheck:jni (already on)
    07-06 19:55:58.170  3837  3837 W art     : Unexpected CPU variant for X86 using defaults: x86
    07-06 19:55:58.177  1678  1984 I ActivityManager: Start proc 3837:com.my.app.sa/u0a86 for activity com.my.app.sa/.MainActivity
    07-06 19:55:58.204  3837  3837 D AndroidRuntime: Shutting down VM
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: FATAL EXCEPTION: main
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: Process: com.my.app.sa, PID: 3837
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzbr; or its super classes (declaration of 'com.google.android.gms.common.internal.zzbr' appears in /data/app/com.my.app.sa-2/base.apk)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:5853)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.installContentProviders(ActivityThread.java:5445)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5384)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.-wrap2(ActivityThread.java)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:102)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6119)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    07-06 19:55:58.205  3837  3837 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
    07-06 19:55:58.207  1678  1689 W ActivityManager:   Force finishing activity com.my.app.sa/.MainActivity
    07-06 19:55:58.268  2270  2270 W SearchService: Abort, client detached.
    07-06 19:55:58.281  1678  3452 I OpenGLRenderer: Initialized EGL, version 1.4
    07-06 19:55:58.281  1678  3452 D OpenGLRenderer: Swap behavior 1
    07-06 19:55:58.281  1678  3452 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
    07-06 19:55:58.281  1678  3452 D OpenGLRenderer: Swap behavior 0
    07-06 19:55:58.282  1678  3452 D EGL_emulation: eglCreateContext: 0xaef87040: maj 2 min 0 rcv 2
    07-06 19:55:58.286  1678  3452 D EGL_emulation: eglMakeCurrent: 0xaef87040: ver 2 0 (tinfo 0x907fffb0)
    07-06 19:55:58.295  1678  3452 D EGL_emulation: eglMakeCurrent: 0xaef87040: ver 2 0 (tinfo 0x907fffb0)
    07-06 19:55:58.713  1678  1692 W ActivityManager: Activity pause timeout for ActivityRecord{e58df8d u0 com.my.app.sa/.MainActivity t7 f}
    07-06 19:55:58.723  1678  1692 I WindowManager: Failed to capture screenshot of Token{4025542 ActivityRecord{e58df8d u0 com.my.app.sa/.MainActivity t7 f}} appWin=Window{6ebdfcb u0 Starting com.my.app.sa} drawState=3
    

    IOS app is ok

  2. Based on @leethree ‘s comment, I worked around this with:

    dependencies {
        compile(project(':react-native-device-info')) {
            exclude group: 'com.google.android.gms', module: 'play-services-gcm'
        }
        compile(project(':react-native-firebase')) {
            transitive = false
        }
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile "com.android.support:appcompat-v7:25.3.1"
        compile "com.google.firebase:firebase-core:11.4.2"
        compile "com.google.firebase:firebase-messaging:11.4.2"
        compile "com.google.android.gms:play-services-base:11.4.2"
        compile "com.google.android.gms:play-services-gcm:11.4.2"
        compile "com.facebook.react:react-native:+"  // From node_modules
    }
    

    The problem is caused by mixing Google Play Services dependencies.

    From react-native-device-info‘s gradle file (as a dependency, using + is arguably the best approach):

    dependencies {
        compile 'com.facebook.react:react-native:+'
        compile 'com.google.android.gms:play-services-gcm:+'
    }
    

    From react-native-firebase‘s gradle file (because they target a specific compatible version):

    buildscript {
      ext.firebaseVersion = '11.4.2'
      ...
    }
    ...
    dependencies {
      ...
      compile "com.google.android.gms:play-services-base:$firebaseVersion"
      ...
    }
    
  3. Pingback: 토토
  4. Pingback: rolex replica
  5. Pingback: wig
  6. Pingback: copy G Shock Sale

Comments are closed.