Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 deleted it appears again. how to solve this?.

Here is 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 } 
like image 568
Andika Ristian Nugraha Avatar asked Mar 21 '18 04:03

Andika Ristian Nugraha


Video Answer


1 Answers

I've faced this issue quite recently and the problem for me was that for some reason the android project.properties file was generated with different versions for the 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 library.2 and library.3 require one version while the library.4 requires a more specific version, thus causing the duplicate library reference during compiling.

While I don't think this should be the final solution, adding the specific library worked for me. 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: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.+ 
like image 121
rpbaltazar Avatar answered Oct 28 '22 00:10

rpbaltazar