Hi,
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 project.properties file which is inside the ‘android’ folder and add this line
android.library.reference.2=../google-play-services_lib
Now when I compile my Haxe project, I get the following error about multiple dex files. (Attaching relevant part of the output)
-dex:
[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]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command$1;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:277)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:245)
[dx] at com.android.dx.command.Main.main(Main.java:106)
[dx]
BUILD FAILED
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 https://github.com/fbricker/openfl-gps-lib. But got the same result.
Is there anything trivial I’m missing? Any help is appreciated.
Thank you.