Multiple dex files define Lcom/google/android/gms/internal/zzau

前端 未结 14 1215
[愿得一人]
[愿得一人] 2020-11-29 10:55

I get the error com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzau; when i run my app The gradle files are

ap

14条回答
  •  北海茫月
    2020-11-29 11:39

    My project is a cordova ionic1 project, I spent a full night and morning to solve this issue, this is what I did beacuse i was having firebase dependencies and google services: Go to this file : platforms\android\cordova-plugin-firebase\cordova-plugin-firebase\app-build.gradle

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            // classpath 'com.google.gms:google-services:3.0.0'
            // i changed the above line from 3.0.0 to 3.1.1
            classpath 'com.google.gms:google-services:3.1.1'
        }
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        compile 'me.leolin:ShortcutBadger:1.1.4@aar'
        //compile 'com.google.firebase:firebase-crash:+'
        // i changed the above line from + to 11.0.2
        compile 'com.google.firebase:firebase-crash:11.0.2'
    }
    

    Then Go to this file: platforms\android\project.properties Originally i was having this

    target=android-26
    android.library.reference.1=CordovaLib
    cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
    cordova.system.library.1=com.google.gms:google-services:+
    cordova.system.library.2=com.google.firebase:firebase-core:+
    cordova.system.library.3=com.google.firebase:firebase-messaging:+
    cordova.system.library.4=com.google.firebase:firebase-crash:+
    cordova.system.library.5=com.google.firebase:firebase-config:+
    cordova.system.library.6=com.android.support:support-v4:24.1.1+
    cordova.system.library.7=com.google.android.gms:play-services-auth:11.+
    cordova.system.library.8=com.google.android.gms:play-services-identity:11.+
    

    Then i commented out the google services as we need specific dependencies and I also put the versions for firebase and gms to the same version number of 11.0.2 so after my file looks like this

    target=android-26
    android.library.reference.1=CordovaLib
    cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
    # cordova.system.library.1=com.google.gms:google-services:+
    cordova.system.library.2=com.google.firebase:firebase-core:11.0.2
    cordova.system.library.3=com.google.firebase:firebase-messaging:11.0.2
    cordova.system.library.4=com.google.firebase:firebase-crash:11.0.2
    cordova.system.library.5=com.google.firebase:firebase-config:11.0.2
    cordova.system.library.6=com.android.support:support-v4:24.1.1+
    cordova.system.library.7=com.google.android.gms:play-services-auth:11.0.2
    cordova.system.library.8=com.google.android.gms:play-services-identity:11.0.2
    

提交回复
热议问题