Trouble adding google-play-services_lib to custom extension

Working on my first Haxe project. I’m trying to create a custom extension to integrate google leaderboard in my haxeflixel game. Here’s what I did.
I created a new extension inside a ‘libs’ folder, which is inside my project (same level as Project.xml), using the following command.

lime create extension CustomLeaderboard

I copied the google-play-services_lib folder from C:\Development\Android SDK\extras\google\google_play_services\libproject and placed it inside E:\Development\WhatTheJump\libs\CustomLeaderboard\dependencies. Alongside the ‘android’ folder.(which is my custom extension project where I’d do the actual integration stuff? correct?)

I opened the file which is inside the ‘android’ folder and add this line


Now when I compile my Haxe project, I get the following error about multiple dex files. (Attaching relevant part of the output)

      [dex] input: E:\Development\WhatTheJump\export\android\bin\bin\classes
      [dex] input: E:\Development\WhatTheJump\export\android\bin\deps\ganalytics\bin\classes.jar
      [dex] input: E:\Development\WhatTheJump\export\android\bin\deps\customleaderboard\bin\classes.jar
      [dex] input: E:\Development\WhatTheJump\export\android\bin\deps\extension-api\bin\classes.jar
      [dex] input: E:\Development\WhatTheJump\export\android\bin\deps\google-play-services_lib\bin\classes.jar
      [dex] input: E:\Development\WhatTheJump\export\android\bin\deps\ganalytics\libs\libGoogleAnalyticsServices.jar
      [dex] input: E:\Development\WhatTheJump\export\android\bin\deps\google-play-services_lib\libs\google-play-services.jar
      [dex] Pre-Dexing E:\Development\WhatTheJump\export\android\bin\deps\ganalytics\bin\classes.jar -> classes-67242f62eb948a0eaa727f70d6deff0a.jar
      [dex] Pre-Dexing E:\Development\WhatTheJump\export\android\bin\deps\customleaderboard\bin\classes.jar -> classes-335ebb418d33aed3925c99c446c09cdb.jar
      [dex] Pre-Dexing E:\Development\WhatTheJump\export\android\bin\deps\extension-api\bin\classes.jar -> classes-7eb14468cd979b49498b8cda0dd7068b.jar
      [dex] Pre-Dexing E:\Development\WhatTheJump\export\android\bin\deps\google-play-services_lib\bin\classes.jar -> classes-e14c5fff32da7c7964188168d41cf471.jar
      [dex] Pre-Dexing E:\Development\WhatTheJump\export\android\bin\deps\ganalytics\libs\libGoogleAnalyticsServices.jar -> libGoogleAnalyticsServices-b973c1b10c862f8c8c62327b2f4dbef6.jar
      [dex] Pre-Dexing E:\Development\WhatTheJump\export\android\bin\deps\google-play-services_lib\libs\google-play-services.jar -> google-play-services-a86a8059c6ac9050810224a62c399ebc.jar
      [dex] Converting compiled files and external libraries into E:\Development\WhatTheJump\export\android\bin\bin\classes.dex...
       [dx] Merged dex A (51 defs/54.9KiB) with dex B (1 defs/3.8KiB). Result is 52 defs/66.9KiB. Took 0.2s
       [dx] Merged dex A (52 defs/66.9KiB) with dex B (1 defs/1.2KiB). Result is 53 defs/81.8KiB. Took 0.0s
       [dx] Merged dex A (53 defs/81.8KiB) with dex B (5 defs/5.6KiB). Result is 58 defs/112.1KiB. Took 0.0s
       [dx] Merged dex A (58 defs/112.1KiB) with dex B (1 defs/0.4KiB). Result is 59 defs/156.8KiB. Took 0.0s
       [dx] Merged dex A (59 defs/156.8KiB) with dex B (502 defs/832.1KiB). Result is 561 defs/1285.8KiB. Took 0.3s
       [dx] Multiple dex files define Lcom/google/android/gms/analytics/internal/Command$1;
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at
       [dx] 	at

C:\Development\Android SDK\tools\ant\build.xml:888: The following error occurred while executing this line:
C:\Development\Android SDK\tools\ant\build.xml:890: The following error occurred while executing this line:
C:\Development\Android SDK\tools\ant\build.xml:902: The following error occurred while executing this line:
C:\Development\Android SDK\tools\ant\build.xml:283: null returned: 2

Total time: 1 minute 46 seconds
Build halted with errors.

I’ve tried

-cleaning the project and rebuilding
-Updated google play services from Android SDK Manger.
-I even tried using this But got the same result.

Is there anything trivial I’m missing? Any help is appreciated.
Thank you.

Perhaps the library is being included more than once? I think you can do <java path="to/your.lib" /> in an include.xml to include an extra lib when compiling, though perhaps @fbricker can help chime in on this

Turns out, you were right. I was using this extension ( for google analytics. Removed that from my project.xml and the errors went away (how silly of me). So the question I now have is, is there a way I can continue using that GA plugin and write my own extension for the leaderboard (which will use google play library) without any conflicts? May be both the project can share the analytics’ jar file from a single location(?). Or would it be easier to have just one extension that handles both?

When an extension is included, it defines it’s name. Perhaps there’s a way to <java path="to/the.jar" unless="ganalytics" /> or something like that?

Let me look into that. I’ll get back if I bump into something else. Thanks for the help :smile: