[Android-development] JNI crash with parameter from Java
raven-worx Software
info at raven-worx.net
Sat Sep 3 13:58:24 CEST 2016
Hi,
i just can't figure out whats going wrong with this simple example:
C++:
void CallJavaMethod()
{
QAndroidJniObject::callStaticMethod<void>( "package/path/to/MyActivity",
"MyMethod",
"(Ljava/lang/String;)V",
QAndroidJniObject::fromString("some-text").object<jstring>() );
}
//registered with JNI
void Callback( jstring str )
{
// as soon as i try to access the jstring the crash occurrs
}
Java:
public static void MyMethod( String str )
{
SendCallback( str /*even with new String(str)*/ ); //native C++
method -> Callback()
}
So pretty straight forward, but i receive the following error as soon
as i try to access the received jstring in C++:
JNI DETECTED ERROR IN APPLICATION: use of invalid jobject
What am i doing wrong?
I am testing on Android 6.
let me know if you need further info.
More information about the Android-development
mailing list