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

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

  

Not sure if anyone else had the same problem, but suddenly all my android app generation started to fail with the same error (full log in attach):

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
Error: more than one library with package name 'com.google.android.gms.license'


From an initial research we've found some similar reportings with react-native, and that had to do with changes in Google Play Services. Since I'm using more that one plugins related with google (maps, onesignal) I feel that might be related with the problem.

Anyone else has the same issue?

I experienced the exact same issue after installing OneSignal. It seems Google Play services 12.0.0 release (20 March 2018) introduced some breaking changes. This probably requires the author to update this component.

I did a temporary quick fix by forking the plugin source https://github.com/OutSystems/OneSignal-Cordova-SDK.git#2.0.12-OS4 then edit the following lines in plugin.xml:

<framework src="com.google.android.gms:play-services-gcm:+" />
<!-- play-services-analytics is only required when gms version 8.1.0 or older is used. -->
<framework src="com.google.android.gms:play-services-analytics:+" />
<framework src="com.google.android.gms:play-services-location:+" />

to point to previous version:

<framework src="com.google.android.gms:play-services-gcm:11.+" />
<!-- play-services-analytics is only required when gms version 8.1.0 or older is used. -->
<framework src="com.google.android.gms:play-services-analytics:11.+" />
<framework src="com.google.android.gms:play-services-location:11.+" />

then I edit the OneSignalPlugin's extensibility configuration to point to my repository instead.

Solution

Hey guys,

Please update your OneSignal Plugin to the latest version available on forge and try again.

Cheers,
Luís Silva

Solution