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

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