Where Does Qt Look For Java Classes When Using Jni
Solution 1:
They should reside in src
folder under your ANDROID_PACKAGE_SOURCE_DIR
.
Lets say I have a java
package org.me.mypack
, then what I do is create the FQ path for the package under:
ANDROID_PACKAGE_SOURCE_DIR/src
Suppose my ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
eventually I will have this path:
$$PWD/android/src/org.me.mypack
and call a static method in my class:
QAndroidJniObject::callStaticMethod<void>("org.me.mypack/Utilities",
"requestPermissions",
"(Landroid/app/Activity;)V",
QtAndroid::androidActivity().object());
So in your case, you ought to create your package path:
ANDROID_PACKAGE_SOURCE_DIR/src/app1
--> $$PWD/android/src/app1
and put your java class file MyJavaClass.java
and other java
classes for the package in that path.
If you haven't already done, check JNI Crash Course, which uses same call as your example, but with different package!
Extending your Qt Android application using JNI
in the example note the file path: //java file android/src/com/kdab/training/MyJavaClass.java
and the call:
return QAndroidJniObject::callStaticMethod<jint>
("com/kdab/training/MyJavaClass"// java class name
, "fibonacci"// method name
, "(I)I"// signature
, n);
Post a Comment for "Where Does Qt Look For Java Classes When Using Jni"