Details
-
Bug
-
Resolution: Invalid
-
P3: Somewhat important
-
None
-
5.5.0
-
None
-
arch linux, qt 5.5, qml, android 5.1.1
Description
with android 5.x art is used by default which is more stricter for calling native code so now one must call CallVoidMethod instead of CallObjectMethod for void functions
example code:
QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative", "activity", "()Landroid/app/Activity;"); QAndroidJniObject pm = activity.callObjectMethod("getPackageManager", "()Landroid/content/pm/PackageManager;"); QAndroidJniObject param = QAndroidJniObject::fromString("com.android.settings"); QAndroidJniObject intent = pm.callObjectMethod("getLaunchIntentForPackage", "(Ljava/lang/String;)Landroid/content/Intent;",param.object<jstring>()); activity.callObjectMethod("startActivity","(Landroid/content/Intent;)V", intent.object<jobject>());
on android < 5.x this works properly, on 5.x this returns:
JNI DETECTED ERROR IN APPLICATION: the return type of CallObjectMethodV does not match void android.app.Activity.startActivity(android.content.Intent)
I don't have direct document, some google results
https://www.linkedin.com/pulse/20141020095300-6497083-getting-your-apps-ready-for-android-lollipop
https://code.google.com/p/android-developer-preview/issues/detail?id=1410
maybe this could be currently solved by using QAndroidJniEnvironment, but I would expect QAndroidJniObject::callVoidMethod in androidextras?