Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

QtAndroid, exchanging data between c++ and android



  • These are 3 example functions

        public void Test01() {
            System.out.println("Test01");
            System.out.println("Test01");
        }
    
        public void Test02(int a) {
            System.out.println("Test02");
            System.out.println("Test02");
        }
    
        public int Test03() {
            System.out.println("Test03");
            System.out.println("Test03");
            return 321;
        }
    

    And that is how I call them

        QtAndroid::androidActivity().callMethod<void>("Test01", "()V");
        QtAndroid::androidActivity().callMethod<void>("Test02", "(I)", 123);
        QtAndroid::androidActivity().callMethod<jint>("Test03", "()V");
    

    Only the first "Test01" works, the second and the third generate the exception

    W System.err: java.lang.NoSuchMethodError: no non-static Test02(I)"
    W System.err: java.lang.NoSuchMethodError: no non-static Test03()V"
    

    Which kind of mistake am I making?



  • QtAndroid::androidActivity().callMethod<void>("Test02", "(I)V", 123);
    QtAndroid::androidActivity().callMethod<jint>("Test03", "()I");


  • The method signatures are wrong.
    2 should be "(I)V", 3 should be "()I"


Log in to reply