I ran into this problem as I tried to update an old Phonegap project we built in 2014 to the latest phonegap platform. The plugin ecosystem has changed, so I removed the old `org....` plugins and added `cordova-plugin-....` instead. I'm developing using CLI tools on Ubuntu linux and targetting android platform 22 at the moment (ios to follow). My phonegap tools are version 5.5.2.
We use Google Analytics, so I added `cordova-plugin-analytics` and this seemed to require `cordova-google-play-services`, and we also use PushPlugin for OTA message push to the device, now the build ends with:
Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
This happens even with a completely new project:
$ phonegap create test2
$ cd test2
$ phonegap platform add android
$ phonegap run -d android
.. this runs on the device fine ..
$ phonegap plugin add cordova-plugin-analytics
$ phonegap plugin add cordova-plugin-pushplugin
$ phonegap run -d android
.. this fails to build with the above error ..
If I search all *.jar files under `plugins` for com.google.android.gms, the only jar that contains it is:
./cordova-google-play-services/libs/google-play-services_lib/libs/google-play-services.jar
The plugin list on the test project is now:
$ phonegap plugin list
cordova-google-play-services 25.0.0 "Google Play Services for Android"
cordova-plugin-analytics 1.3.3 "Google Analytics Plugin"
cordova-plugin-device 1.1.1 "Device"
cordova-plugin-globalization 1.0.2 "Globalization"
cordova-plugin-pushplugin 2.6.1 "PushPlugin"
cordova-plugin-whitelist 1.2.1 "Whitelist"
I've been researching this 'more than one library with package name...' error, and there is advice on the web about removing your `android` platform and adding it again (`phonegap platform rm android ; phonegap platform add android`) and similar, but this problem occurs even with a completely fresh project.
So, is the error message correct? Should I try to fix it or work around it? (e.g. editing setting `enforceUniquePackageName=false` and if so, where do I do that in a Phonegap project?) Is one of the plugins buggy and somehow the jar is being included on a classpath twice or similar horrible shennanigans?
This guy
https://groups.google.com/forum/#!searchin/phonegap/more$20than$20one$20library$20with$20package$20name/phonegap/AzW4Xv5O524/OJ8-x1uGAAAJ seemed to have a similar problem but he's on Windows and he seems to have hit a dead end.
Losing a lot of time on this, any advice appreciated.
Nick