1 thought on “Android build failed @ task ‘:app:transformClassesWithJarMergingForDebug’

  1. @simonhintersonnleitner you most likely have duplicate android libs, especially if you’re using multiple modules that require firebase, modify your android/app/build.gradle dependencies section to explicitly compile a certain firebase version and then exclude from other project compiles, e.g here’s what ours sort of looks like:

    // ...
    dependencies {
        compile (project(':react-native-firebase')) {
           // EXCLUDED:
            exclude group: "com.google.android.gms"
            exclude group: "com.google.firebase"
        }
    
        compile (project(':react-native-google-analytics-bridge')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':react-native-push-notification')) {
            exclude group: "com.google.android.gms"
            exclude group: "me.leolin.ShortcutBadger"
        }
    
        compile (project(':react-native-appsflyer')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':RNAdMob')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':react-native-fcm')) {
            exclude group: "com.google.firebase"
            exclude group: "me.leolin.ShortcutBadger"
        }
    
        compile 'com.google.android.gms:play-services-base:10.2.0'
        compile 'com.google.android.gms:play-services-gcm:10.2.0'
        compile 'com.google.android.gms:play-services-analytics:10.2.0'
        compile 'com.google.android.gms:play-services-location:10.2.0'
        compile 'com.google.android.gms:play-services-ads:10.2.0'
        compile 'com.google.android.gms:play-services-identity:10.2.0'
    
    
        compile 'com.google.firebase:firebase-core:10.2.0'
        compile 'com.google.firebase:firebase-ads:10.2.0'
        compile 'com.google.firebase:firebase-config:10.2.0'
        compile 'com.google.firebase:firebase-auth:10.2.0'
        compile 'com.google.firebase:firebase-analytics:10.2.0'
        compile 'com.google.firebase:firebase-database:10.2.0'
        compile 'com.google.firebase:firebase-storage:10.2.0'
        compile 'com.google.firebase:firebase-messaging:10.2.0'
        compile 'com.google.firebase:firebase-crash:10.2.0'
    
    
        compile ('com.google.android.gms:play-services-gcm:10.2.0') {
            force = true;
        }
    
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile 'com.facebook.react:react-native:+'  // From node_modules
    }
    // ...

    Same applies to other google libs like com.google.android.gms as above

Comments are closed.

1 thought on “Android build failed @ task ‘:app:transformClassesWithJarMergingForDebug’

  1. @simonhintersonnleitner you most likely have duplicate android libs, especially if you’re using multiple modules that require firebase, modify your android/app/build.gradle dependencies section to explicitly compile a certain firebase version and then exclude from other project compiles, e.g here’s what ours sort of looks like:

    // ...
    dependencies {
        compile (project(':react-native-firebase')) {
           // EXCLUDED:
            exclude group: "com.google.android.gms"
            exclude group: "com.google.firebase"
        }
    
        compile (project(':react-native-google-analytics-bridge')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':react-native-push-notification')) {
            exclude group: "com.google.android.gms"
            exclude group: "me.leolin.ShortcutBadger"
        }
    
        compile (project(':react-native-appsflyer')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':react-native-device-info')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':RNAdMob')) {
            exclude group: "com.google.android.gms"
        }
    
        compile (project(':react-native-fcm')) {
            exclude group: "com.google.firebase"
            exclude group: "me.leolin.ShortcutBadger"
        }
    
        compile 'com.google.android.gms:play-services-base:10.2.0'
        compile 'com.google.android.gms:play-services-gcm:10.2.0'
        compile 'com.google.android.gms:play-services-analytics:10.2.0'
        compile 'com.google.android.gms:play-services-location:10.2.0'
        compile 'com.google.android.gms:play-services-ads:10.2.0'
        compile 'com.google.android.gms:play-services-identity:10.2.0'
    
    
        compile 'com.google.firebase:firebase-core:10.2.0'
        compile 'com.google.firebase:firebase-ads:10.2.0'
        compile 'com.google.firebase:firebase-config:10.2.0'
        compile 'com.google.firebase:firebase-auth:10.2.0'
        compile 'com.google.firebase:firebase-analytics:10.2.0'
        compile 'com.google.firebase:firebase-database:10.2.0'
        compile 'com.google.firebase:firebase-storage:10.2.0'
        compile 'com.google.firebase:firebase-messaging:10.2.0'
        compile 'com.google.firebase:firebase-crash:10.2.0'
    
    
        compile ('com.google.android.gms:play-services-gcm:10.2.0') {
            force = true;
        }
    
        compile fileTree(dir: "libs", include: ["*.jar"])
        compile 'com.facebook.react:react-native:+'  // From node_modules
    }
    // ...

    Same applies to other google libs like com.google.android.gms as above

Comments are closed.