Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24722] Android: Ti Modules causing conflict with google play services

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2017-10-30T18:16:55.000+0000
Affected Version/sRelease 6.0.4
Fix Version/sRelease 6.3.0
Componentsn/a
Labelsn/a
Reporter Ricardo Ramirez
AssigneeGary Mathews
Created2017-05-23T17:14:21.000+0000
Updated2017-10-30T18:18:05.000+0000

Description

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

Attachments

FileDateSize
Errorlog.rtf2017-07-04T19:17:47.000+000014594
TestPlayServicesApp.zip2017-05-23T17:16:09.000+000010213157
testplayservicesmodule.zip2017-05-23T17:15:31.000+00002970726

Comments

  1. Ricardo Ramirez 2017-05-23

    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.
  2. Ricardo Ramirez 2017-05-23

    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.
  3. Ricardo Ramirez 2017-07-04

    The customer is having some issues. Please check the attached logs
  4. Eric Merriman 2017-07-26

    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?
  5. Ricardo Ramirez 2017-09-04

    Can we add more information on the docs ?
  6. Hans Knöchel 2017-09-10

    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!
  7. Hans Knöchel 2017-09-12

    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.
  8. Hans Knöchel 2017-09-12

    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
  9. Hans Knöchel 2017-09-29

    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.
  10. Caio Perdona 2017-10-18

    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?
  11. Gary Mathews 2017-10-20

    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
  12. Eric Merriman 2017-10-27

    [~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.
  13. Caio Perdona 2017-10-27

  14. Lokesh Choudhary 2017-10-28

    [~gmathews], When I run with admob 3.0.2 & cloudpush 4.0.4 together the build fails with error:
        [ERROR] :  Failed to package application:
        [ERROR] :  
        [ERROR] :  /Users/lchoudhary/Desktop/workspaces/workspace_2016/Z123/build/android/AndroidManifest.xml:25: error: Error: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version').
        [ERROR] Application Installer abnormal process termination. Process exit value was 1
        
  15. Gary Mathews 2017-10-30

    [~lchoudhary] Updated the pre-releases, should fix that issue.
  16. Caio Perdona 2017-10-30

    Can you give us a more detailed workaround? Which version from which module to use, compatible with which SDK?
  17. Lokesh Choudhary 2017-10-30

    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 & no Failed 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

JSON Source