Firebase: Android build error with Error: more than one library with package name 'com.google.android.gms.license'


#1

Hi,

I am trying to build android apk, but the build command failed with error,

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

I uses fcm plugin for push notification.

cli packages:

@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.3.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.7.1

System:

Node  : v8.9.1
npm   : 5.5.1 
OS    : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b 

iOS building works fine.
Any suggestion is appreciable.

Thanks


More than one library with package name 'com.google.android.gms.license' Ask
Error: more than one library with package name 'com.google.android.gms.license'
#2

Have you found the solution for this?


#3

Same here looking for a solution…


#4

Before adding FCM can run on Android.
After adding FCM I get the same error as above.
Any help appreciated?


#5

Please see this. Maybe helped you: https://github.com/facebook/react-native/issues/18479


#6

Same problem here. Seems to be happening starting today with new firebase 12.0.0 library. Before that, previous release 11.8.0 works just fine. Still trying to figure out what’s wrong, but from the change history, some firebase libraries now referencing to same library name 'com.google.android.gms.license’


#7

Same problem here. Unable to build app for android platform. Uses FCM. The contents of starter-FCMPlugin.gradle file is:

buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath ‘com.google.gms:google-services:3.0.0’
}
}
// apply plugin: ‘com.google.gms.google-services’
// class must be used instead of id(string) to be able to apply plugin from non-root gradle file
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin


#8

In my case, I managed to solve it by aligning all version of com.google.firebase in ‘platforms/android/project.properties’ to older version such as below:

cordova.system.library.4=com.google.firebase:firebase-core:11.+
cordova.system.library.5=com.google.firebase:firebase-messaging:11.+
cordova.system.library.6=com.google.firebase:firebase-crash:11.+
cordova.system.library.7=com.google.firebase:firebase-config:11.+
cordova.system.library.8=com.google.android.gms:play-services-location:11.+
cordova.system.library.9=com.google.android.gms:play-services-auth:11.+
cordova.system.library.10=com.google.android.gms:play-services-identity:11.+

The above was changed to: 11.+ from previously: +

Also, any includes, e.g. (cordova-plugin-firebase/android-build.gradle) should also be changed as above. This might be temporary solution until managed to figure out what’s wrong with version 12.0.0 release.


#9

I did this too and its working now.

Found a similar solution here by rpbaltazar,


#10

Thanks. It resolved my issue


#11

changing to 11.+ seems to work. Thanks
Will stick to this first


#12

But I don’t have ‘com.google.android.gms:play-services’ in my project.properties file.
How to proceed with your suggestion.

Thanks.


#13

what do you have there?

for me these were the changes i made:

before,
cordova.system.library.1=com.google.firebase:firebase-core:+
cordova.system.library.2=com.google.firebase:firebase-messaging:+

after,
cordova.system.library.1=com.google.firebase:firebase-core:11.+
cordova.system.library.2=com.google.firebase:firebase-messaging:11.+

i think my issue was the firebase FCM version 12.0 library.


#14

Hi,
My project.propertie contains:

  target=android-26
  android.library.reference.1=CordovaLib
  cordova.gradle.include.1=com.radaee.cordova/xxx-build-extras.gradle
  cordova.system.library.1=com.android.support:support-v4:24.1.1+
  cordova.system.library.2=com.google.firebase:firebase-core:+
  cordova.system.library.3=com.google.firebase:firebase-messaging:+
  cordova.gradle.include.2=cordova-plugin-fcm/xxx-FCMPlugin.gradle

Thanks.


#15

simply add “11.+” to your “com.google.firebase:firebase-core:” and “com.google.firebase:firebase-core:”

hope it works!


#16

Could you tell me how to set this? here cordova-plugin-firebase/android-build.gradle

classpath 'com.google.gms:google-services:3.1.0'


#17

For me, my cordova-plugin-firebase/android-build.gradle has more things:

dependencies {
compile 'me.leolin:ShortcutBadger:1.1.4@aar’
compile ‘com.google.firebase:firebase-crash:11.+’
}

I just set the compile 'com.google.firebase:firebase-crash to 11+ instead of +, no need to change the com.google.gms:google-services


#18

Hi @robinx087,
It worked for me :grinning::grinning:

Thanks.


#19

Thanks a lot. This is working fine :slight_smile:


#20

Hi,

content of my project.properties, I had tried to change + to 11.8.0 for all libraries, but of no avail.
Am i doing it wrong, reply would be much appreciated.

target=android-26
android.library.reference.1=CordovaLib
cordova.gradle.include.1=cordova-plugin-firebase/build1-build.gradle
cordova.system.library.1=com.google.gms:google-services:+
cordova.system.library.2=com.google.android.gms:play-services-tagmanager:+
cordova.system.library.3=com.google.firebase:firebase-core:+
cordova.system.library.4=com.google.firebase:firebase-messaging:+
cordova.system.library.5=com.google.firebase:firebase-crash:+
cordova.system.library.6=com.google.firebase:firebase-config:+
cordova.gradle.include.2=cordova-plugin-googlemaps/build1-tbxml-android.gradle
cordova.system.library.7=com.google.android.gms:play-services-maps:11.8.0
cordova.system.library.8=com.google.android.gms:play-services-location:11.8.0
cordova.system.library.9=com.android.support:support-core-utils:24.1.0

Thanks