SDKBOX 1.2.3.3 Android Studio error

I was trying to compile SDKBOX using android-studio console comand

Cocos2d-x3.8rc0 C++

cocos run -p android --android-studio

Got following error:

:libcocos2dx:compileReleaseJava
Executing task ':libcocos2dx:compileReleaseJava' (up-to-date check took 0.034 secs) due to:
  No history is available.
All input files are considered out-of-date for incremental task ':libcocos2dx:compileReleaseJava'.
Compiling with JDK Java compiler API.
MY_DIR/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java:50: error: package com.sdkbox.plugin does not exist
import com.sdkbox.plugin.SDKBox;
                        ^
MY_DIR/cocos2d/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxActivity.java:226: error: cannot find symbol
        SDKBox.init(this);

It seems JAR files not picked in Cocos2dxActivity when using gradle build system, how to fix this manually?

I don’t know what the fix is, but let us as @Ibon if he has any ideas.

@Ibon Just solved this issue:
copied libs folder

from

cocos2d/cocos/platform/android/java/libs

to

cocos2d/cocos/platform/android/libcocos2dx/libs

should be libs folder duplicated automatically when installing plugin thru console?

Now it can’t find Google Play Servicesâ€Ļ will check how to solve it in gradle.

Managed to compile:

Added to build.gradle into dependencies google play services (version is old need to check which is latest)

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    **compile 'com.google.android.gms:play-services:5.0.89'**
    compile project(':libcocos2dx')
}

Copied files from proj.android/res/values and proj.android/res/xml
to
proj.android-studio/res

Seems SDKBOX console command not copied/configured properly adnroid studio project

can you run sdkbox symbols and paste the output. That will help us diagnose the problem.

after adding facebook SDK manually to project and making previous manipulations stuck on error, which seems other users also discovered:

JNI DETECTED ERROR IN APPLICATION: JNI GetStringUTFChars called with pending exception 'android.content.res.Resources$NotFoundException' thrown in unknown throw location
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]     in call to GetStringUTFChars
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]     from void org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(int, int)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65] "GLThread 6089" prio=5 tid=16 Runnable
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   | group="main" sCount=0 dsCount=0 obj=0x12c22380 self=0xb4a1a800
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   | sysTid=28334 nice=0 cgrp=default sched=0/0 handle=0xb491c680
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   | state=R schedstat=( 47968646 25260157 66 ) utm=2 stm=2 core=2 HZ=100
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   | stack=0xa1d21000-0xa1d23000 stackSize=1036KB
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   | held mutexes= "mutator lock"(shared held)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #00 pc 00004e64  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+23)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #01 pc 00003665  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+8)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #02 pc 00256429  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+84)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #03 pc 00238fe7  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+158)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #04 pc 000b191b  /system/lib/libart.so (art::JniAbort(char const*, char const*)+610)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #05 pc 000b2055  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+68)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #06 pc 000b530f  /system/lib/libart.so (art::ScopedCheck::ScopedCheck(_JNIEnv*, int, char const*)+1346)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #07 pc 000be215  /system/lib/libart.so (art::CheckJNI::GetStringUTFChars(_JNIEnv*, _jstring*, unsigned char*)+44)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #08 pc 00158283  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::JNIUtils::NewStringFromJString(_jstring*, _JNIEnv*)+28)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #09 pc 00157903  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (_ZN6sdkbox15JNIInvokeStaticISsIEEET_PKcS3_DpT0_+78)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #10 pc 00157971  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::TrackingInfo::getAppName()+12)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #11 pc 0015358b  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::Tracking::initialize()+46)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #12 pc 001503a7  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxCore::initialize()+14)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #13 pc 0015041b  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::SdkboxCore::getInstance()+30)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #14 pc 0014240b  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::GoogleAnalyticsWrapper::init()+22)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #15 pc 0014267f  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (sdkbox::PluginGoogleAnalytics::init()+6)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #16 pc 00129f5f  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (AppDelegate::applicationDidFinishLaunching()+14)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #17 pc 0015a3c9  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (cocos2d::Application::run()+6)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #18 pc 0015b329  /data/app/com.getme.now-1/lib/arm/libcocos2dcpp.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+104)
09-04 16:29:08.997  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   native: #19 pc 0032087d  /data/dalvik-cache/arm/data@app@com.getme.now-1@base.apk@classes.dex (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit__II+88)
09-04 16:29:08.998  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native method)
09-04 16:29:08.998  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:74)
09-04 16:29:08.998  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1500)
09-04 16:29:08.998  28314-28334/com.getme.now A/artīš• art/runtime/check_jni.cc:65]   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)

It was PITA to use SDKBox and compile it via “cocos run”, anywayâ€Ļ I downloaded the samples code and tried to compile it and it went to error tooâ€Ļ Don’t know whether SDKBox tag line is still relevant “End SDK Fatigue”, because of all the errors and crashesâ€Ļ and all crashes and errors I encountered is all asked in the forum but there’s no definite answer for it about how to fix that.

1 Like

Hi, is there any comment on this? Is it SDKBOX +gradle compatibility issue? or wrong configuration on our side?

We are still working on Android Studio integration. For now cocos run.. is the best way to work with SDKBOX on Android.

If you have errors and crashes, please let us know what you are experiencing so we can help.

@slackmoehrle xmm I mean I’m already using

cocos run ... --android-studio

But it not compiling project properly, so should it work or not with console command if I compiling it thru gradle(android studio setup)

I mean, no Android Studio at all:

cocos run -p android

@slackmoehrle

Is there estimated date/release date for Android Studio, for us it is big dilemma
SDKBOX or Android Studio.

To understand can we wait until it is implementedâ€Ļ or should look for workaround.

Let me ask the engineering team today in our sync up meeting.

We should support Android Studio with the 9/16 release.

@slackmoehrle
Awesome! :slight_smile:

Hey, have you released today new version of SDKBOX or what is current situation?:slight_smile: