skip to Main Content

My android/app/build.gradle (bottom):

dependencies {
    compile project(':react-native-onesignal')
    compile project(':react-native-youtube')
    compile(project(":react-native-google-sign-in")) {
        exclude group: "com.google.android.gms"
    } 
    compile project(':react-native-svg')
    compile project(':react-native-facebook-login')
    compile project(':react-native-i18n')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.google.android.gms:play-services-auth:10.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}


apply plugin: 'com.google.gms.google-services'

My android/build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

The error:

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/auth/api/signin/zzc;

I’ve tried various solutions and nothing works :/
Seems to be some sort of version mismatch, but I don’t know how to match it.

2

Answers


  1. Chosen as BEST ANSWER

    The solution to the issue was the following:

    My build.gradle had this line:

    com.google.android.gms:play-services-auth:10.0.1
    

    So I had to change /node_modules/react-native-onesignal/android/build.gradle like this:

    compile 'com.google.android.gms:play-services-gcm:10.0.1'
    compile 'com.google.android.gms:play-services-analytics:10.0.1'
    compile 'com.google.android.gms:play-services-location:10.0.1'
    

    This is the only thing that worked after trying all other solutions I found online.


  2. just enable multidex as following:

    android {    
      defaultConfig {
        // Enabling multidex support.
        multiDexEnabled true
      }  
    }
      dependencies {
      compile 'com.android.support:multidex:1.0.0'
    }
    

    create one class like this

    public class Multi_Dex extends Application {
      @Override
      protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
      }
    }
    

    now in your manifiest file add this

    <application
        android:name=".Multi_Dex"
        android:allowBackup="true"
        android:icon="@drawable/logo"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search