Page 1 of 1

[SOLVED] Irrlicht Android - nativeEnvJ2C

Posted: Tue Jan 28, 2014 5:06 pm
by AlfAlien
I ran into problem - my test application displays in LogCat

Code: Select all

com.ellismarkov.irrlicht    Irrlicht    not handled /mnt/sdcard
The problem in the following funciton

Code: Select all

 
void Java_com_ellismarkov_irrlicht_IrrlichtTest_nativeEnvJ2C(JNIEnv* env, jobject defaultObj, jstring jsdcardPath)
{
    char ligne[1024 + 1];
    const char *msg = env->GetStringUTFChars(jsdcardPath, 0);
    gSdCardPath = msg;
    __android_log_print(ANDROID_LOG_INFO, "Irrlicht", "not handled %s", gSdCardPath.c_str()); //=> ERROR IS HERE
    env->ReleaseStringUTFChars(jsdcardPath, msg);
}
 
What this function (nativeEnvJ2C) makes? Why I cannot handle SD card?

Re: Irrlicht Android - nativeEnvJ2C

Posted: Tue Jan 28, 2014 6:49 pm
by Nadro
Which version of Irrlicht do you use? It looks like you're using some unofficial Android port.

Re: Irrlicht Android - nativeEnvJ2C

Posted: Wed Jan 29, 2014 8:32 am
by AlfAlien
Hello! I use https://gitorious.org/irrlichtandroid, it's based on irrlicht 1.7. I thought it's the only available official port.
This function resides in project/jni/android-activity.cpp. I know that it's native method implementation, just can't understand why we need this function.
Do you know any other irrlicht android ports?
P.S. I finally understood what this function makes - it converts java string (path to SD Card) to native c++ string, then you can use this c++ string in your c++ code.

Re: Irrlicht Android - nativeEnvJ2C

Posted: Wed Jan 29, 2014 9:38 am
by Nadro
Hi,

Please check this one (example no. 27 is dedicated for Android):
svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es

Cheers,

Re: Irrlicht Android - nativeEnvJ2C

Posted: Wed Jan 29, 2014 12:52 pm
by AlfAlien
Thanks! I didn't know about that. It also contains native activity demos - that's great!