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

When I try to run the ionic cordova build android out error command as above. Then I try to delete one of the gms , when I create the deleted again, it appears again. how to solve it ?.

Here are my dependencies of my build.gradle :

 dependencies { compile fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: "CordovaLib", configuration: "debug")) releaseCompile(project(path: "CordovaLib", configuration: "release")) compile "com.google.android.gms:play-services-auth:+" // i remove this compile "com.google.android.gms:play-services-identity:+" compile "com.facebook.android:facebook-android-sdk:4.+" // SUB-PROJECT DEPENDENCIES END } 
+19
source share
15 answers

I ran into this problem quite recently, and the problem for me was that for some reason the android file project.properties was generated with different versions for com.google.android.gms as such:

 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:+ cordova.system.library.3=com.google.android.gms:play-services-identity:+ cordova.system.library.4=com.google.android.gms:play-services-location:11.+ 

This makes the .2 library and library.3 the same version, while library 4 requires a more specific version, which leads to duplication of the reference library at compile time.

Although I don't think this should be the final solution, adding a specific library worked for me. In this way:

 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.+ 
+11
source

in build.gradle add this

 configurations.all { resolutionStrategy { force "com.google.android.gms:play-services-ads:11.8.0" force "com.google.android.gms:play-services-base:11.8.0" force "com.google.android.gms:play-services-gcm:11.8.0" force "com.google.android.gms:play-services-analytics:11.8.0" force "com.google.android.gms:play-services-location:11.8.0" force "com.google.android.gms:play-services-basement:11.8.0" force "com.google.android.gms:play-services-tagmanager:11.8.0" force 'com.google.firebase:firebase-core:11.8.0' force 'com.google.firebase:firebase-crash:11.8.0' force 'com.google.firebase:firebase-auth:11.8.0' force 'com.google.firebase:firebase-common:11.8.0' force 'com.google.firebase:firebase-config:11.8.0' force 'com.google.firebase:firebase-messaging:11.8.0' } } 

if this does not work, search the string '12 .0.0 'in your project and add the missing library to the list above

+13
source

This is due to Play Services 12.0.0. I went ahead and downgraded the dependencies to 11.8.0 (the latest known working version for my project). I am using native response. I had 2 dependencies that occupied 12.0.0 google play services - com.google.android:play-services...12.0.0 I hope this helps.

+5
source

Perhaps this is due to the new version of Google Play services 12.0.0 (released March 20, 2018) I decided to install the dependencies: Add configuration to android/build.gradle

 allprojects { repositories { ... configurations.all { resolutionStrategy { // Add force (11.0.0 is version you want to use) force 'com.google.firebase:firebase-core:11.0.0' force 'com.google.firebase:firebase-crash:11.0.0' force 'com.google.firebase:firebase-analytics:11.0.0' force 'com.google.firebase:firebase-messaging:11.0.0' force 'com.google.android.gms:play-services-base:11.0.0' force 'com.google.android.gms:play-services-maps:11.0.0' force 'com.google.android.gms:play-services-wallet:11.0.0' } } } } 

Dependencies depend on your android/app/build.gradle

+5
source

Things I had to do to succeed in my Ionic3 app:

  • Add plugin cordova-android-play-services- gradle -release
  • Remove and add the Android platform again.
  • 11. + in the platform / android / project.properties file for libraries (especially if you use firebase)
  • 11. + for dependencies in the platforms / android / cordova -plugin-firebase / -build.gradle
  • The above platform changes /android/build.gradle

This may be the worst way to get everything working, but it seems to have saved my life. Hope this helps someone!

+3
source

In my case

 npm update cordova platform remove android cordova platform add android@6.4.0 

And replace in the platform /android/projet.properties

 cordova.system.library.1=com.android.support:support-v4+ 

For

 cordova.system.library.1=com.android.support:support-v4:26+ 
+3
source

When you run the ionic cordova command , you can change the version, I have the same error, and I fixed the problem by changing the version of my node modules, my cordova plugin, version from Android studio.

My config 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 shell (type: Wrapper) {gradleVersion = '2.14.1'}

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

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

Gradle version: 3.3 com.google.android.gms: docking services: 11.4.2

In some cases, the node module and cordova plugin are wrong, so you manually delete them in the folder. Remember to remove and add the cordova plugin when updating it.

Try going to android studio => files => project structure => project => ok Normally, Android studio should sync your gradle

OR

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

In my case, the problem was that I included:

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

both wearable game services and conventional ones. I commented on the wear resistant part and it works. I'm not sure that I will need it, but it was turned on by the project wizard by default

I hope I can help you. Go on!

+2
source

just change the 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.+ 

it worked for me

+2
source

This works for me.

 node_modules/react-native-camera/android/build.gradle: dependencies { compile 'com.facebook.react:react-native:+' compile 'com.google.android.gms:play-services-gcm:11.8.0' // update by me on 20180321 } 
+2
source

You can use the cordova-android-play-services-gradle-release plugin to align the versions defined by the various plugins during the Cordova build process.

Install it using the desired version, for example:

 cordova plugin add cordova-android-play-services-gradle-release --variable PLAY_SERVICES_VERSION=12.0.0 
+2
source

For reference: https://developers.google.com/android/guides/releases

Google API for Android

March 20, 2018 - version 12.0.0

Known issues with version 12.0.0

  • ...
  • POM dependency licenses call "more than one library with the package name com.google.android.gms.license" in Ionic Pro.
  • ...

We will provide an updated version 12.0.1 to solve these problems in the near future.


My workaround

(based on jeremy castelli answer and keldar subsequent comment)

I use the following workaround (and emphasize this workaround).

Add the following to the bottom of build-extras.gradle: create a file if necessary.

 configurations.all { resolutionStrategy { force 'com.google.firebase:firebase-core:11.8+', 'com.google.firebase:firebase-messaging:11.8+', 'com.google.firebase:firebase-crash:11.8+', 'com.google.firebase:firebase-config:11.8+', 'com.google.firebase:firebase-auth:11.8+', 'com.google.android.gms:play-services-tagmanager:11.8+', 'com.google.android.gms:play-services-location:11.8+' } } 

It is important to include the entire firebase database and all the links to the android.gms libraries, if you miss only one of them, it will not be created anyway. Grep your gradle files for all links. In my case, I skipped firebase-auth, which was referenced by the file with the firebase.gradle plugin.

What resolutionStrategy force does is override version options made by the project / plugins and force gradle to reference the specific version.

There is no need to edit the project.properties file or any other gradle files with this workaround.

+2
source

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

So you need to change something:

 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: 

in

 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. 
+1
source

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

+1
source

1. Go to project.properties (in the folder of your platform)

2. I only used google analytics in my "project.properties" and had to add "11. +" until the end of the version, and it worked for me. Not sure if it will fix this for a long time, but he did the trick.

 cordova.system.library.2=com.google.android.gms:play-services-analytics:11.+ 
+1
source

I encountered the same error in my ion project, after a little search that I read to update the Android platform, which is required for the latest Android Gradle plugin to create an application.

The solution is very simple , just follow the step below.

  • Remove the existing Anroid platform.

ion cordova platform remove android

  1. Add the minimum version of Android SDK Build Tools 26.0.2 via the Android SDK Manager to use the latest Android Gradle plugin to create an application

  2. Add minimum version for Android platform

ionic cordon platform add android@ ^ 6.4.0

+1
source

Source: https://habr.com/ru/post/1275999/


All Articles