SDKBOX Android Studio build failed

SDKBOX Android Studio build failed
0

#1

I failed to build android apk with sdkbox.
I’m using cocos2d-x 3.16, Android Studio 3.11 and android-ndk-r14b.

I created a new project.

cocos new aatest -p info.mygames888.aatest -l cpp

And import sdkbox

cd aatest
sdkbox import AdMob
sdkbox import share

Import of sdkbox succeeded.
I opened Android Studio project.
And I edited gradle.properties.

PROP_COMPILE_SDK_VERSION=23
PROP_MIN_SDK_VERSION=10
PROP_TARGET_SDK_VERSION=23
PROP_APP_PLATFORM=10
PROP_APP_ABI=armeabi

And edited app/build.gradle.
I changed buildToolsVersion to “27.0.3”.

I tried to compile android apk.

cocos run -p android --android-studio

And I failed to build. This is the error log.

:aatest:transformClassesWithDexForDebug FAILED
:aatest:transformClassesWithDexForDebug (Thread[Task worker Thread 3,5,main]) completed. Took 28.374 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':aatest:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --verbose --num-threads=4 --output /Users/masanori/aatest/proj.android-studio/app/build/intermediates/transforms/dex/debug/folders/1000/1f/main /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_2e1c02fa737faea64c3ddc3f1ab9a1a35613ca1e.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_5cc36b76d680b6424bb872ea883f8b40859470d1.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_b212cd801825b85aba266515c0efcb3e2d13a234.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_9b9e0e33aa8d3b8af7aa0d42ce217bce3cffa15c.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/google-play-services_60384f8619e2448aef3e47f9e76a5fad9e51238a.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_17f5d6016577ec90e68a076d864bc5e22703e3ff.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/twitter-text-1.13.0_7d523d64a50e3f01482e039705cfb39ae3d0fa32.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/retrofit-1.8.0_df74356a3b32e16dcdb651fd49df7eb3e158977d.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/com.android.vending.expansion.zipfile_8759006d70caaf4724319e7c547cea9aea257447.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/sdkbox_df6c04802cc554e7bb107bb25215e1452113edeb.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/PluginAdMob_37f349aa2274edf6b5204e536411e2792bfebc71.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_233551d7cfd16588f98ea95efa80c2e136183687.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/gson-2.3_9730599658b9f6076c5c1e99f46884534bd27662.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/picasso-2.5.2_019f04febcffd6780810e480786273eb71ddfe58.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/retrofit-1.8.0_c8ff3ba3b634c73347d5cecc88e5f6f1b7166c95.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_229bf193d54c4431c46cd35621b2dc331b00b99c.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/PluginSdkboxAds_ae4ded40d0fe0753e2ee50e3e1bc6fc2e9447d75.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/debug_0db38fb9395136a8c2806d484977ae7ae6d878ce.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/classes_339a85ac3d50b9db8c16c929026a6bc8c70cd6fa.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/EngineDataManager_a2e2a7c6c694d9096035ccd0256a26925b31d05f.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/android-async-http-1.4.9_1ba8bf9fdff806518681d1c590d62225621206bf.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/httpclient-4.4.1.1_ef5a976440a8ad2a86ce18caa39a79d9fc613c29.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/PluginShare_ea0d74d0179abd3cb73910db31efa99ed8abb562.jar /Users/masanori/aatest/proj.android-studio/app/build/intermediates/pre-dexed/debug/android-support-v4_75953f358b6166046845694df3d2bf64d530d673.jar}

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 2.905 secs
PREDEX CACHE HITS:   0
PREDEX CACHE MISSES: 23
Stopped 0 worker daemon(s).
Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':aatest:transformClassesWithDexForDebug'.] from daemon DaemonInfo{pid=66672, address=[0fd85aa9-ef2a-4661-acbb-ce6cac60f862 port:53634, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1524234079814, context=DefaultDaemonContext[uid=4d33bcf6-1b8b-4e25-869f-691541fb0961,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home,daemonRegistryDir=/Users/masanori/.gradle/daemon,pid=66672,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=JP,-Duser.language=ja,-Duser.variant]} (build should be done).
Error running command, return code: 1.

Before importing sdkbox, the build succeeded.
How can I make a build successful?

Thank you.


#2

crash log not fulll you just pasted some generic output, I think u excided 64k limit on dex and should enable multidex.


#3

for Android App Over 64K Methods

http://docs.sdkbox.com/en/qa/android_64k/


#4

@energyy
@yinjimmy

Thank you for your reply.
After adding ‘multiDexEnabled true’ to app/build.gradle and changing minSdkVersion to 21, I can now build it.

app/build.gradle

android {
    compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
    buildToolsVersion "27.0.3"
    defaultConfig {
        applicationId "info.mydomain.appname"
        minSdkVersion PROP_MIN_SDK_VERSION
        targetSdkVersion PROP_TARGET_SDK_VERSION
        versionCode 1
        versionName "1.0"
        multiDexEnabled true

gradle.properties

PROP_COMPILE_SDK_VERSION=23
PROP_MIN_SDK_VERSION=21
PROP_TARGET_SDK_VERSION=23
PROP_APP_PLATFORM=10
PROP_APP_ABI=armeabi