Multiple DEX files error with sdkbox-fyber-sample

Hi All,

If I start with a clean SDKBox Fyber sample app, go into cpp, run cocos compile -p android, it works fine.

If I add the Facebook SDK with sdkbox import facebook, it will no longer compile, instead fails with error:

[dx] com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

Is this an issue with the pre-built SDKBox SDKs or is there some way I can fix this?

Thanks

Try deleting this file and see if it works

proj.android/libs/support-v4-18.0.0.jar

Thank you, that worked for the Fyber sample, however the same problem occurs in my production environment. I can also replicate it with a brand new Cocos2d-x project with my required SDKBox SDKs:

cocos new TestApp -p com.mygamestudio.testapp -l cpp -d ./testapp

cd testapp/TestApp

sdkbox import googleanalytics
sdkbox import review
sdkbox import adcolony
sdkbox import fyber
sdkbox import facebook
sdkbox import vungle
sdkbox import chartboost
sdkbox import iap

cocos compile -p android

The compile process fails with a multiple dex error:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

If I search for the support-v4 library, I find two jars that are created during the compilation:

find . -name 'support*' -exec ls -l {} \;
-rw-r--r-- 1 <user> staff 563264 Nov  4 10:23 ./cocos2d/cocos/platform/android/java/libs/support-v4-18.0.0.jar
-rw-r--r-- 1 <user> staff 563264 Nov  4 10:23 ./cocos2d/cocos/platform/android/libcocos2dx/libs/support-v4-18.0.0.jar
-rw-r--r-- 1 <user> staff 214733 Nov  4 10:29 ./proj.android/bin/dexedLibs/support-v4-18.0.0-38acdd305737db2fe3be1ef4513dff87.jar

I’m not sure if this is an error within my dev set up or if two (or more) of the SDKBox SDKs are calling for a build of the support-v4 library.

Thanks for any insight.

The reason is that Some plugin they requires the same .jar lib file, but renamed it for some reason…
So sdkbox installed a same jar (or same jar but different version) twice, that will result in a multiple dex error.

Basically, anytime you see multiple dex error that means there is a duplicate of jar libs

If you’re using android-studio build, you’ll have to remove this one as well

cocos2d/cocos/platform/android/libcocos2dx/libs/support-v4-18.0.0.jar

Moving forward, we’re looking into using dependency system to download jar libs.

1 Like

By moving all three jar files from the project directories after the first test compile was complete, I was able to get the project to compile and run.

Some kind of dependency manager would be very welcome.

Thanks for your help.