SDKBOX multidex issue?

SDKBOX multidex issue?
0.0 0

#1

It seems like since I updated sdkbox, I cannot compile in debug mode anymore.
I get the following error:

-dex:
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\proj.android\bin\classes
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\bin\classes.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\gps\bin\classes.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\proj.android\plugin_review_res_project\bin\classes.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\facebook_lib\bin\classes.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\appcompat\bin\classes.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\cardview\bin\classes.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginReview.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\org.apache.http.legacy.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginAdMob.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginFacebook.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android-support-v4.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\gps\libs\google-play-services.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginIAP.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\com.android.vending.expansion.zipfile.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\sdkbox.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\httpclient-4.4.1.1.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginChartboost.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android-async-http-1.4.9.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginAdColony.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\cardview\libs\android-support-v7-cardview.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\facebook_lib\libs\bolts-android-1.1.2.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\adcolony.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginGoogleAnalytics.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\appcompat\libs\android-support-v7-appcompat.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\facebook_lib\libs\facebook-android-4.17.0.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\chartboost.jar
      [dex] input: D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginGooglePlay.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\bin\classes.jar -> classes-b9638ea142e9c4c35d3e5423c8a23018.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\gps\bin\classes.jar -> classes-fe4d426c8ea6377e4831e059912879e9.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\proj.android\plugin_review_res_project\bin\classes.jar -> classes-11607424b1fbbbe7f7efe7fc6d7a5c66.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\facebook_lib\bin\classes.jar -> classes-002b4c8811673c8c4f3175f2257d4303.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\appcompat\bin\classes.jar -> classes-15dc4c6b92818473023064ec1d38c0c8.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\cardview\bin\classes.jar -> classes-df1511a2f14b46e6d80b2d4093c54c44.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginReview.jar -> PluginReview-d002716ead010bf8b0864726b55dd225.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\org.apache.http.legacy.jar -> org.apache.http.legacy-ee4f56865c040337d8515222a3a6784d.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginAdMob.jar -> PluginAdMob-70452721494f3791fcf4115611315151.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginFacebook.jar -> PluginFacebook-5f9c0063ce18b64c6869bd4c9cb8cfb0.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android-support-v4.jar -> android-support-v4-262cafa5586ae83e7030a1033959e058.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\gps\libs\google-play-services.jar -> google-play-services-c34870d5650f3b5e9fbcfc2208a3923e.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginIAP.jar -> PluginIAP-eb4058474cded8482c36dadfe7407d13.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\com.android.vending.expansion.zipfile.jar -> com.android.vending.expansion.zipfile-c67785c2367fb19454af56613f598afc.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\sdkbox.jar -> sdkbox-13773874b65aaf9331b2fec5e0566b3e.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\httpclient-4.4.1.1.jar -> httpclient-4.4.1.1-f5d7895bb0a6ec00b4b811511c6811d4.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginChartboost.jar -> PluginChartboost-a8831b5c765c73ebcb81f2a96a0d87d7.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android-async-http-1.4.9.jar -> android-async-http-1.4.9-44d75a7b0396ced378139961ec339ea6.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginAdColony.jar -> PluginAdColony-f1849e91b6c3ab17320040d3f022a5d9.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\cardview\libs\android-support-v7-cardview.jar -> android-support-v7-cardview-96e68b4a02acf35b4cea9a6b08d02aa8.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\facebook_lib\libs\bolts-android-1.1.2.jar -> bolts-android-1.1.2-e7d1422cac75ce8f3f9dfa7b03060e96.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\adcolony.jar -> adcolony-18c8612ce124215e8f153e9cedccfea2.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginGoogleAnalytics.jar -> PluginGoogleAnalytics-79bd7c88fb79e28394493fbe6eac8212.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\android_support_v7\appcompat\libs\android-support-v7-appcompat.jar -> android-support-v7-appcompat-c37fca49609312703705b2771012c02a.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\facebook_lib\libs\facebook-android-4.17.0.jar -> facebook-android-4.17.0-724a7b158f83724f46a1587e73ec403c.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\chartboost.jar -> chartboost-5ab101e64a70322416824b58e98fc591.jar
      [dex] Pre-Dexing D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\cocos2d\cocos\platform\android\java\libs\PluginGooglePlay.jar -> PluginGooglePlay-24c7db94fb3e5946c02a52cdeb02bced.jar
      [dex] Converting compiled files and external libraries into D:\WORK\Projets\Cocos2dX\PopNBlast\Sources\cocos_v3.13\PopNBlast\proj.android\bin\classes.dex...
       [dx]
       [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
       [dx] com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
       [dx]     at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:495)
       [dx]     at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
       [dx]     at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:504)
       [dx]     at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
       [dx]     at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
       [dx]     at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
       [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:\Android\AppData\Sdk\tools\ant\build.xml:888: The following error occurred while executing this line:
C:\Android\AppData\Sdk\tools\ant\build.xml:890: The following error occurred while executing this line:
C:\Android\AppData\Sdk\tools\ant\build.xml:902: The following error occurred while executing this line:
C:\Android\AppData\Sdk\tools\ant\build.xml:283: null returned: 2

Note that I don’t get this when compiling in release mode…

How can I solve this and where does it come from?
Thank you!

PS: if it compiles in release but not in debug, can it imply I would get some instability in release? Is it somewhat linked to proguard? (I use proguard in release, not in debug)


#2

yeah, it happens when adding some SDK’s + SDKBOX , if it is android-studio project it is easy to fix by using multidex solution -

https://developer.android.com/studio/build/multidex.html

Add gradle commands, adjust manifest file - not sure if need to change AppActivity - for me it worked without chaning it.


#3

Thanks for your answer!
However I don’t use android-studio.
I compile in console using “cocos run -p android”.

I am not sure about what multi dex implies? How does it impact my app?


#4

Check URL - there is desribed what it could cause - but in 99% cases that fine. My recoomendation if using cocos 3.7+ switch to Android-Studio it’s really easy to move there - little changes in Android.mk and adjustments in gradle. If you have specific to your current integrations questions ask in forum.

Multi-dex I think available only with Android-Studio (gradle build) , like it caching java functions in multiple files instead of 1 :slight_smile:


#5

Hi,

Did you manage to solve this issue? I’m having the same problem after installing 3 or more SDKs from SDKBOX. Did you use ProGuard or any other solution? I’m also wondering how using multi-dex impacts an app?

Thanks.