Issue Description
At creating an appcelerator android module which uses Google Play services.
I'm using the libraries 'play-services-base-9.4.0.jar' and 'play-services-basement-9.4.0.jar' in my appc module which is attached - testplayservicesmodule.zip
If i use this project in the appc app, everything is working fine.
But, if I add ti.map module as well to my appc app, it is giving error as 'Failed to run dexer' since the ti.map is also using similar jars in it.
Steps to reproduce
1. Import project TestPlayServicesApp.zip into Appc Studio.
2. Import timap module
3. Run the application.
You will see the following error log:
[ERROR] : Failed to run dexer:
[ERROR] :
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/actions/ItemListIntents;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/actions/NoteIntents;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/actions/ReserveIntents;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/actions/SearchIntents;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient$Info;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient$zza;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/auth/api/signin/GoogleSignInAccount;
[ERROR] : Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/auth/api/signin/GoogleSignInAccount$1;
[ERROR] :
[ERROR] : UNEXPECTED TOP-LEVEL EXCEPTION:
[ERROR] : java.lang.RuntimeException: Translation has been interrupted
[ERROR] : at com.android.dx.command.dexer.Main.processAllFiles(Main.java:613)
[ERROR] : at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
[ERROR] : at com.android.dx.command.dexer.Main.run(Main.java:275)
[ERROR] : at com.android.dx.command.dexer.Main.main(Main.java:245)
[ERROR] : at com.android.dx.command.Main.main(Main.java:106)
[ERROR] : Caused by: java.lang.InterruptedException: Too many errors
[ERROR] : at com.android.dx.command.dexer.Main.processAllFiles(Main.java:605)
[ERROR] : ... 4 more
Earlier customer was able to fix this issue by referencing the play services jars from external location instead of copying the libraries to the project. But now, if I do the same thing, packaging the module is giving me error as 'Package does not exist'. Because of this reason, I had to copy the jars to lib folder in the module which is causing this conflict now.
Customer found another workaround for this issue. Before adding the packaged module(testplayservicesmodule) to app, if the google play services libs are removed from it, everything is working fine. But this approach will have the dependency on ti.map module to be used in the app. If ti.map module is removed, testplayservicesmodule will not have the required libraries.
The customer is having some issues. Please check the attached logs
Normally we recommend in these cases that only one version of google play services be used to avoid such collisions. The other possibility is to sync the versions when multiple versions are included. Is either of these options a workable solution in this case?
Can we add more information on the docs ?
Hey guys, this just popped up [here](https://github.com/AppWerft/Ti.Firebase/issues/3) (Ti.Firebase community module) and in TIMOB-25251 (ticket opened based on the feedback from the Github issue). There seems to be a general issue with different google-play JAR's causing issues for developers, so we should come up with a solution that aligns the google-play version to a unified one. I also remember we fixed something related in 6.2.0 already, so this might even be a non-issue. Maybe [~gmathews] or [~jquick] worked on this? Thanks guys!
Hey there! I just updated Ti.Map to use the *very* latest Google Play Services (11.0.4) [here](https://github.com/appcelerator-modules/ti.map/pull/213). So if the other native module is able to use the same one (probably just a PR to that branch), it will be compatible on the fly. Please note that newer versions of the Google Play Services like 11.x have a dependency on the support-library as well, which we updated in 6.2.0, so 6.2.0 will be required to run this version of Ti.Map. Side-Note: We will bump the Ti.Map Android version (currently 3.4.0) to 4.0.0 in Titanium SDK 7.0.0, which would be a breaking change anyway, but I wanted to ensure that Titanium SDK 6.x users can still use this important PR before we bump the minimum Titanium SDK to 7.0.0.
One more PR for Ti.Admob to update Play Services 9.x to 11.0.4: https://github.com/appcelerator-modules/ti.admob/pull/72
Quick update here: Our Android-team did some work to have an official "ti.playservices" module that can be plugged in modules like ti.map, ti.cloudpush and this one, simply by adding it as a dependency in the timodule.xml. See [this PR](https://github.com/appcelerator-modules/ti.map/pull/214) for more info.
I know this issue is old, but whats the status? Every time Titanium version bump requires me to update my modules, I run into JAR conflicting with Ti.Map. And this is making maintaining an Android Titanium app a bit painful... Is there a correct way to work this around?
ti.admob: https://github.com/appcelerator-modules/ti.admob/releases/tag/android-3.0.2 cloudpush: https://github.com/appcelerator-modules/cloudpush/releases/tag/android-4.0.4
[~perdona] I have disliked this approach for many years. The team has devised a solution that will make you life easier in this regard, and it should be in 7.0.0 SDK.
[~gmathews], When I run with
admob 3.0.2
&cloudpush 4.0.4
together the build fails with error:[~lchoudhary] Updated the pre-releases, should fix that issue.
Can you give us a more detailed workaround? Which version from which module to use, compatible with which SDK?
Verified the fix. Ran the modules having google play services together & after the update of google play services in
ti.admob
&cloudpush
there is no conflict & noFailed to run dexer
error. Closing. Studio Ver: 4.10.0.201709271713 SDK Ver: 6.2.2.GA OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.10-2 Appc CLI: 6.3.0-master.15 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.6 Node Ver: 7.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1 ⇨ google Nexus 6P --- Android 8.0.0 Modules: ti.admob -- 3.0.2 cloudpush -- 4.0.4