Unable to compile CocosCreator 2 project (Android) with SDKBOX AdMob

emm, sorry, you need to overwrite the sdkbox file with http://staging.sdkbox.com/installer/v1/sdkbox_installer.zip.

~/.sdkbox/bin/ is the location of sdkbox command.
or plz wait 1 hour, I update the sdkbox command version.

Thanks,

Hi @yinjimmy

As always, thank you for providing the fix.

When I tried executing the sdkbox import admob --staging, installation/update of the respective package was successful. However, when I tried recompiling my application, another problem appeared.

  1. build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\org\cocos2dx\javascript\AppActivity.java:38: error: package com.sdkbox.plugin does not exist.

In line with that, I noticed that the SDKBox related libs are missing in my project so I tried following the manual integration guide wherein I copied the SDKBox related libs from plugin/android/libs folder to my project’s /libs folder. The libs I copied are as follows:

  • android-support-v4.jar
  • PluginAdMob.jar
  • PluginSdkboxAds.jar
  • sdkbox.jar
  • google-play-services.jar

I was able to verify that the JNIs are already on my projects jni directory so I didn’t need to recopy them again.

Upon doing the above steps however, I encountered another error regarding
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

Partial Compilation logs:

All input files are considered out-of-date for incremental task ':AdMob_v2:mergeDebugAssets'.
Unable do incremental execution: full task run
:AdMob_v2:mergeDebugAssets (Thread[Task worker for ':',5,main]) completed. Took 0.344 secs.
:AdMob_v2:transformClassesWithDexBuilderForDebug (Thread[Task worker for ':',5,main]) started.
:AdMob_v2:transformClassesWithDexBuilderForDebug
Putting task artifact state for task ':AdMob_v2:transformClassesWithDexBuilderForDebug' into context took 0.0 secs.
Executing task ':AdMob_v2:transformClassesWithDexBuilderForDebug' (up-to-date check took 0.046 secs) due to:
  No history is available.
All input files are considered out-of-date for incremental task ':AdMob_v2:transformClassesWithDexBuilderForDebug'.
Task is incremental : false 
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs\android-support-v4.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs\google-play-services.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs\PluginAdMob.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs\PluginSdkboxAds.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs\sdkbox.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\cocos2d-x\cocos\platform\android\java\libs\android-async-http-1.4.9.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\cocos2d-x\cocos\platform\android\java\libs\com.android.vending.expansion.zipfile.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\cocos2d-x\cocos\platform\android\java\libs\httpclient-4.4.1.1.jar
Dexing {}
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\cocos2d-x\cocos\platform\android\java\libs\libcocosanalytics.jar
Dexing {}
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-ads-12.0.1.aar\d4d1d2a9e6999e9eb53faaf8edd236dc\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-ads-lite-12.0.1.aar\9c1d09595ab23ada2a748291ef0c0282\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-gass-12.0.1.aar\3768c1f2105ac53fc99fb1cc66f2ef8c\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-basement-12.0.1.aar\8e552446a22955e5db7b649b1b7b6daa\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-ads-license-12.0.1.aar\6be6b13d1fc3ae090bd7f7f0ed6cac32\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-ads-lite-license-12.0.1.aar\da68a6f545c9ca936128e362d212846f\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\support-v4-26.1.0.aar\18c58a541fdefca73885e2989052fa23\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-basement-license-12.0.1.aar\0a0aa2b09fa068c16734705bcd81238e\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\play-services-gass-license-12.0.1.aar\880396a5a5ab29a768a644a176415236\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\support-media-compat-26.1.0.aar\ae9c8e5d18ce0f43ded1684f67f18667\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\support-fragment-26.1.0.aar\e774e1eaea2d683898c62ce5626a0eb3\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\support-core-utils-26.1.0.aar\dc8e5fad88cf584bafeed366277383ce\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\support-core-ui-26.1.0.aar\92f77d0a738a0aeb5a831875df1d1c7f\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\support-compat-26.1.0.aar\ee33df8a3909de25379c5ddd4139aa94\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\modules-2\files-2.1\com.android.support\support-annotations\26.1.0\814258103cf26a15fcc26ecce35f5b7d24b73f8\support-annotations-26.1.0.jar
Jar input C:\Users\Pat\.gradle\caches\transforms-1\files-1.1\runtime-1.0.0.aar\d0501603028456513db0bf9270443520\jars\classes.jar
Jar input C:\Users\Pat\.gradle\caches\modules-2\files-2.1\android.arch.lifecycle\common\1.0.0\e414a4cb28434e25c4f6aa71426eb20cf4874ae9\common-1.0.0.jar
Jar input C:\Users\Pat\.gradle\caches\modules-2\files-2.1\android.arch.core\common\1.0.0\a2d487452376193fc8c103dd2b9bd5f2b1b44563\common-1.0.0.jar
Jar input D:\proj\AdMob_v2\build\jsb-default\frameworks\cocos2d-x\cocos\platform\android\libcocos2dx\build\intermediates\intermediate-jars\debug\classes.jar
Dexing {}
Dir input D:\proj\AdMob_v2\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\build\intermediates\classes\debug
Dexing {}
Done with all dex archive conversions
:AdMob_v2:transformClassesWithDexBuilderForDebug (Thread[Task worker for ':',5,main]) completed. Took 7.141 secs.
:AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug (Thread[Task worker for ':',5,main]) started.
:AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug
Putting task artifact state for task ':AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug' into context took 0.0 secs.
Executing task ':AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug' (up-to-date check took 0.027 secs) due to:
  No history is available.
All input files are considered out-of-date for incremental task ':AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug'.
:AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
:AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug (Thread[Task worker for ':',5,main]) completed. Took 0.578 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':AdMob_v2:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

I did try cleaning my build (deleting the builds folder, and rebuild/compile again, but the problem still persists.

Hoping that you can guide me on this issue again.

Thanks in advance.

I have the same exact problem error: 'cocos2d::Director' has not been declared
/build/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/…/…/…/Classes/SDKBoxJSHelper.cpp: In member function ‘void sdkbox::JSListenerBase::invokeJSFun(const string&, const ValueArray&)’:
/build/jsb-default/frameworks/runtime-src/proj.android-studio/app/jni/…/…/…/Classes/SDKBoxJSHelper.cpp:37:18: error: ‘cocos2d::Director’ has not been declared
cocos2d::Director::getInstance()->getScheduler()->performFunctionInCocosThread(funName, params, this{
^
make: *** [/build/jsb-default/frameworks/runtime-src/proj.android-studio/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/objs-debug/cocos2djs_shared///__/Classes/SDKBoxJSHelper.o] Error 1
make: *** Waiting for unfinished jobs…

Hi @mostafaz4,

Have you tried updating sdkbox to the staging version or update the SDKBoxJSHelper in jsb-default\frameworks\runtime-src\Classes manually?

The staging version seems still there are some bug with creator v2.x, plz just use the files:

We’re fixing this.

Hi @yinjimmy,

I was able to test and compile my app using the SDKBox staging version after some minor tweaks.

sdkbox import admob --staging

  • AdMob 2.4.1.0
  • Google Play Services 2.4.1.0
  • SDKBox Ads 2.4.1.0

Steps:

  1. Done the manual integration for android after sdkbox import (http://docs.sdkbox.com/en/plugins/admob/v3-js/)
  2. Enable multidex (https://developer.android.com/studio/build/multidex)

However, although I was able to successfully compile and run my app with the above steps, I did notice some problem whenever I try running the app that was compiled with debug enabled (Cocos Creator Build windows).

 E/AndroidRuntime(19564): FATAL EXCEPTION: main
 E/AndroidRuntime(19564): Process: org.pat.AdMob_v2, PID: 19564
 E/AndroidRuntime(19564): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.pat.AdMob_v2/org.cocos2dx.javascript.AppActivity}: java.lang.ClassNotFoundException: Didn't find class "org.cocos2dx.javascript.AppActivity" on path: DexPathList[[zip file "/data/app/org.pat.AdMob_v2-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.pat.AdMob_v2-1, /vendor/lib, /system/lib]]
 E/AndroidRuntime(19564): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2126)
 E/AndroidRuntime(19564): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
 E/AndroidRuntime(19564): 	at android.app.ActivityThread.access$800(ActivityThread.java:139)
 E/AndroidRuntime(19564): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
 E/AndroidRuntime(19564): 	at android.os.Handler.dispatchMessage(Handler.java:102)
 E/AndroidRuntime(19564): 	at android.os.Looper.loop(Looper.java:136)
 E/AndroidRuntime(19564): 	at android.app.ActivityThread.main(ActivityThread.java:5105)
 E/AndroidRuntime(19564): 	at java.lang.reflect.Method.invokeNative(Native Method)
 E/AndroidRuntime(19564): 	at java.lang.reflect.Method.invoke(Method.java:515)
 E/AndroidRuntime(19564): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
 E/AndroidRuntime(19564): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
 E/AndroidRuntime(19564): 	at dalvik.system.NativeStart.main(Native Method)
 E/AndroidRuntime(19564): Caused by: java.lang.ClassNotFoundException: Didn't find class "org.cocos2dx.javascript.AppActivity" on path: DexPathList[[zip file "/data/app/org.pat.AdMob_v2-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.pat.AdMob_v2-1, /vendor/lib, /system/lib]]
 E/AndroidRuntime(19564): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 E/AndroidRuntime(19564): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
 E/AndroidRuntime(19564): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
 E/AndroidRuntime(19564): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
 E/AndroidRuntime(19564): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2117)
 E/AndroidRuntime(19564): 	... 11 more

Not sure why this happens only when Debug is enabled. I’m trying to look around and will update and I found anything useful.

As always, thanks for your help.

remove all your test app on your android device then try again.

Hi yinjimmy,

Same problem. Even if I deleted all of my test app on my android device, the problem still persists if I build using debug enabled.

worked for me - I’m using Cocos creator v2.0.1 - remember to check the “SDKBox Staging server” in the sdkbox GUI panel (open the panel from menu Extension > SDKBox > Launch ) before importing any plugins

yes, from SDKBox GUI 1.1.9 version, you can try our staging server.

After import facebook and compile, my project build failed, below is log, i use staging version in creator 2.0.1

D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\org\cocos2dx\javascript\AppActivity.java:38: error: package com.sdkbox.plugin does not exist
public class AppActivity extends com.sdkbox.plugin.SDKBoxActivity {

plz update to staging to check again, thanks.

https://github.com/sdkbox/sdkbox-sample-ccc200 demo

I tried again (delete plugin folder in .sdkbox folder and redownload facebook 2.4.1.0) but nothing changed, below is log, I test in windows 10 and use template default

:Game:javaPreCompileDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
:Game:javaPreCompileDebug
Putting task artifact state for task ':Game:javaPreCompileDebug' into context took 0.001 secs.
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
Executing task ':Game:javaPreCompileDebug' (up-to-date check took 0.161 secs) due to:
  No history is available.
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
:Game:javaPreCompileDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.176 secs.
:Game:compileDebugJavaWithJavac (Thread[Task worker for ':' Thread 3,5,main]) started.
:Game:compileDebugJavaWithJavac
Putting task artifact state for task ':Game:compileDebugJavaWithJavac' into context took 0.0 secs.
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\main\java', not found
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\main\java', not found
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\debug\java', not found
Executing task ':Game:compileDebugJavaWithJavac' (up-to-date check took 0.263 secs) due to:
  No history is available.
All input files are considered out-of-date for incremental task ':Game:compileDebugJavaWithJavac'.
Compiling with source level 1.7 and target level 1.7.
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
:Game:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\main\java', not found
file or directory 'D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\debug\java', not found
Compiling with JDK Java compiler API.
D:\Work\Javascript\Project\Creator\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\src\org\cocos2dx\javascript\AppActivity.java:38: error: package com.sdkbox.plugin does not exist
public class AppActivity extends com.sdkbox.plugin.SDKBoxActivity {

I tried new empty project, import sdkbox facebook and I still encounter the same error (AppActivity.java:38: error: package com.sdkbox.plugin does not exist), please fix it.

Hi @huyhungkun,

I tried again to use SDKBOX today, and also encountered the same problem as you have mentioned despite having SDKBox Staging Server enabled.

When I did the manual integration however, the compilation problem disappear.

Here are some steps I did: (I’m assuming your compiling for Android device as well)

  1. Go to each respective plugin folder (you are using) in .sdkbox. (For your case, its the facebook 2.4.1.0),
  2. Under each respective plugin folder, copy the plugin lib jar files and paste it to your jsb-default (android project) java lib folder.

For the plugins lib: normally it is in .sdkbox\plugins\<plugin folder>\plugin\android\libs

For the jsb java lib folder: normally it is in .\build\jsb-default\frameworks\cocos2d-x\cocos\platform\android\java\libs

  1. Afterwards, try recompiling it again.

The above solution fixes my problem with regards to error: package com.sdkbox.plugin does not exist

@yinjimmy can you confirm on this to see if this workaround can help. Thank you.

@thienhaflash I’ve also confirmed that the problem with regards to debug is already fix for Cocos Creator v2.0.1 / SDKBox Staging Server. Thanks!

1 Like

thanks, it worked :smiley:

That’s great @huyhungkun

Hi @yinjimmy, just wanting to ask if you notice if there are any steps that I might have missed when I try to use the facebook share support. Thanks in advance.

I’m currently following the tutorial guide on implementing the share feature of SDKBox in (http://docs.sdkbox.com/en/plugins/share/v3-js/)
When I try installing the SDKBox facebook plugin, it seems that I encountered some problem.

You will also need to import SDKBOX facebook plugin if you want enable facebook share support

When I use both Social Sharing plugin and Facebook plugin together, it seems that it is causing some unable to merge dex problem.

All input files are considered out-of-date for incremental task ':sampleappshare:mergeDebugAssets'.
Unable do incremental execution: full task run
file or directory 'D:\dev\mobile-sampleappshare-dev\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
:sampleappshare:mergeDebugAssets (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.825 secs.
:sampleappshare:transformClassesWithDexBuilderForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
:sampleappshare:transformClassesWithDexBuilderForDebug
Putting task artifact state for task ':sampleappshare:transformClassesWithDexBuilderForDebug' into context took 0.0 secs.
file or directory 'D:\dev\mobile-sampleappshare-dev\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
file or directory 'D:\dev\mobile-sampleappshare-dev\build\jsb-default\frameworks\runtime-src\proj.android-studio\app\libs', not found
Skipping task ':sampleappshare:transformClassesWithDexBuilderForDebug' as it is up-to-date (took 0.089 secs).
:sampleappshare:transformClassesWithDexBuilderForDebug UP-TO-DATE
:sampleappshare:transformClassesWithDexBuilderForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.091 secs.
:sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug (Thread[Task worker for ':' Thread 3,5,main]) started.
:sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug
Putting task artifact state for task ':sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug' into context took 0.0 secs.
Executing task ':sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug' (up-to-date check took 0.033 secs) due to:
  Task has failed previously.
All input files are considered out-of-date for incremental task ':sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug'.
:sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
:sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 2.338 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sampleappshare:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

When I tried enable multiDex, the compilation continues a little bit, but still end up with the following error instead:

:sampleappshare:transformClassesWithMultidexlistForDebug (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 7.695 secs.
:sampleappshare:transformDexArchiveWithDexMergerForDebug (Thread[Task worker for ':' Thread 2,5,main]) started.
:sampleappshare:transformDexArchiveWithDexMergerForDebug
Putting task artifact state for task ':sampleappshare:transformDexArchiveWithDexMergerForDebug' into context took 0.0 secs.
Executing task ':sampleappshare:transformDexArchiveWithDexMergerForDebug' (up-to-date check took 0.032 secs) due to:
  No history is available.
All input files are considered out-of-date for incremental task ':sampleappshare:transformDexArchiveWithDexMergerForDebug'.
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/facebook/share/widget/AppInviteDialog$Result;
    UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/facebook/share/widget/AppInviteDialog$Result;

com.android.dex.DexException: Multiple dex files define Lcom/facebook/share/widget/AppInviteDialog$Result;
	at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
	at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
	at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
	at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
	at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
	at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
	at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
	at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
:sampleappshare:transformDexArchiveWithDexMergerForDebug FAILED
:sampleappshare:transformDexArchiveWithDexMergerForDebug (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.849 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sampleappshare:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/facebook/share/widget/AppInviteDialog$Result;

I tried deleting and rebuilding, but the problem still persists.

Version:

  • Cocos Creator 2.0.1
  • SDKBox Facebok Plugin 2.4.1.1 (installed via SDKBox Staging Server)
  • SDKBox Share Plugin 2.4.1.1 (installed via SDKBox Staging Server)

I think you should use android studio to build apk first, at least, error message in android studio more clearly. In your case, I think some library of your plugins is duplicate, or some library is loaded in build.gradle but your project still contain jar file of it :smiley:

1 Like

Thanks @huyhungkun

I was able to identify that my Facebook plugin lib has duplicate on my project which causes the dex problem

1 Like

there are two version of facebook plugin

one in frameworks/runtime-src/proj.android-studio/app/libs folder
another one is in app/build.gradle.

just remove the one in frameworks/runtime-src/proj.android-studio/app/libs folder

1 Like