Error: more than one library with package name com.google.android.gms.license

前端 未结 15 1428
清歌不尽
清歌不尽 2020-12-09 15:59

When I try to run the command ionic cordova build android out error as title above. Then I try to remove one of the gms, when I build again the del

相关标签:
15条回答
  • 2020-12-09 16:12

    When you run the command ionic cordova you can change the version,I have the same error, and i fixed the problem by changing version my nodes modules, my plugin cordova, version off android studio.

    My conf below:

    ANDROID STUDIO: 3.0.0

    pply plugin: 'com.android.application'
    

    buildscript { repositories { jcenter() maven { url "https://maven.google.com" } }

    // Switch the Android Gradle plugin version requirement depending on the
    // installed version of Gradle. This dependency is documented at
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility
    // and https://issues.apache.org/jira/browse/CB-8143
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'com.google.gms:google-services:3.1.1' // google-services plugin
    }
    

    }

    // Allow plugins to declare Maven dependencies via build-extras.gradle. allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } }

    task wrapper(type: Wrapper) { gradleVersion = '2.14.1' }

    ... ... ...
    ... ...

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

    Gradle version : 3.3 com.google.android.gms:play-services:11.4.2

    Some times node module and cordova plugin gets himself wrong, so you do delete manually in the folder. Don’t forget to remove and add cordova plugin when you update it.

    Try to go in android studio => files => project structure => project =>ok Normally android studio should synchonize your gradle

    OR

    Error: more than one library with package name com.google.android.gms.license

    In my case, the problem was because I was including:

    compile 'com.google.android.gms:play-services-wearable:+'
    compile 'com.google.android.gms:play-services:4.4.52'
    

    both the wearable play services, and the regular. I commented out the wearable part, and it works. Not sure if I'll need it, but it was included by default by the project wizard

    I hope I can help you. Keep going !

    0 讨论(0)
  • 2020-12-09 16:12

    Only this worked for me in build.gradle:

    allprojects {
        repositories {
            ...
            configurations.all {
                resolutionStrategy.eachDependency { DependencyResolveDetails details ->
                    def requested = details.requested
                    if (requested.group == 'com.google.android.gms') {
                        details.useVersion '11.8.0'
                    }
                    if (requested.group == 'com.google.firebase') {
                        details.useVersion '11.8.0'
                    }
                }
            }
        }
    }
    

    https://github.com/evollu/react-native-fcm/issues/857#issuecomment-375243825

    0 讨论(0)
  • 2020-12-09 16:20

    just change platform/android/project.properties to

    target=android-26
    android.library.reference.1=CordovaLib
    cordova.system.library.1=com.android.support:support-v4:24.1.1+
    cordova.system.library.2=com.google.android.gms:play-services-auth:11.+
    cordova.system.library.3=com.google.android.gms:play-services-identity:11.+
    cordova.system.library.4=com.google.android.gms:play-services-location:11.+
    

    this worked for me

    0 讨论(0)
  • 2020-12-09 16:24

    I was facing the same error in my ionic project, after little search I have read about to upgrade the Android platform which is required for latest Android Gradle Plugin in order to build the app.

    The solution to is very easy just follow the below mentioned step.

    1. Remove your existing Anroid platform

    ionic cordova platform remove android

    1. Add minimum version Android SDK Build Tools 26.0.2 through Android SDK Manager to use latest Android Gradle Plugin in order to build the app

    2. Add minimum version for Android platform

    ionic cordova platform add android@^6.4.0

    0 讨论(0)
  • 2020-12-09 16:25

    This happening because of Play services 12.0.0. I went ahead and downgraded the dependencies to 11.8.0 ( last known working version for my project). I'm using react native. I had 2 dependencies which were pulling in 12.0.0 of google play services - com.google.android:play-services...12.0.0 Hope this helps.

    0 讨论(0)
  • 2020-12-09 16:25

    For me, it was a matter of adding version number to Google Play Services in project.properies file.

    So you need to change something like:

    android.library.reference.1=CordovaLib
    cordova.system.library.2=com.google.android.gms:play-services-auth:
    cordova.system.library.3=com.google.android.gms:play-services-identity:
    

    to:

    android.library.reference.1=CordovaLib
    cordova.system.library.2=com.google.android.gms:play-services-auth:11.
    cordova.system.library.3=com.google.android.gms:play-services-identity:11.
    
    0 讨论(0)
提交回复
热议问题