Starting from an empty Qt for Android project, created with Qt Creator, how do I execute native Java code?
For example, if I have this java method:
class HelloJava {
public static String sayHello(int a, int b) {
return "Hello from Java, a+b=" + (a+b);
}
}
And I have this Qt method which should call the HelloJava.sayHello() method:
QString call_HelloJava_sayHello(int a, int b) {
// What goes in here?
}
Where do I put the Java code in my project, and what goes inside the call_HelloJava_sayHello() method?
The Qt doc is pretty verbose on the subject:
So the sig of your function should be
"(I;I;)Ljava/lang/String;"And also this:
So it seems you need to specify that and the java files are automatically deployed.
Just add this to your .pro file (assuming your java sources are placed at
/path/to/project/myjava/src:_PRO_FILE_PWD_is a qmake variable that will resolve to the project directory.