Search code examples
androidgoogle-analyticsappcelerator-mobile

Analytics module doesn't work on Android Ti.SDK 5.1.2.GA


I'm trying to use the version 3.1.0 of analytics.google module because the version 1.0 doesn't work on Android Lollipop 6.0.

When I start the app, this error is showed:

Failed to run dexer:
[ERROR] :  
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/LocationSource;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/GoogleMap$4;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/StreetViewPanorama$OnStreetViewPanoramaChangeListener;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/StreetViewPanoramaFragment;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/GoogleMap$InfoWindowAdapter;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/MapsInitializer;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/MapFragment;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/GoogleMap$OnMyLocationButtonClickListener;
[ERROR] :  Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/maps/UiSettings;
[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:608)
[ERROR] :   at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
[ERROR] :   at com.android.dx.command.dexer.Main.run(Main.java:277)
[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:600)
[ERROR] :   ... 4 more

It seems that the google-play-services.jar is duplicated, but if I remove this jar I can't compile the module.


Solution

  • Google play services is included in many android modules (ti.cloudpush, ti.map, ti.admob, and ti.dfp, for example) . You have conflicting versions of the library.

    My recommendation is to select one version of google-play-services.jar and forcibly replace the jar files in all the google play services modules in use by your project with this one version.

    If you have to update google-play-services.jar for one of the appcelerator modules (like ti.map), you might want to make a copy of the module in your project directory rather than altering the module in your SDK directory.

    Note that some of the newer modules are now using individual API jar files for google play services. This is to avoid the bloat of the full google-play-services.jar (and maxing out the number of methods that the dexer can handle).

    But those individual jar files are still versioned, and you can still end up in conflict, so for those modules, just replace all of the individual API jar files with the one google-play-services.jar file that you select.

    I have not had any problem if I replace the jar file with a newer version. You can cross-reference your jar file versions against this document: http://www.smorgasbork.com/2015/01/05/google-play-services-sdk-version-history/

    One last bit of advice -- if you end up with dexer problems because of too many methods, you can unpack the google-play-services.jar file and rip out parts of it (in my case, games, drive, vision, wallet, and wearable).

    All of this is a royal PITA, and I hope Appcelerator is giving this the highest priority.