Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Can't create java class by QAndroidJniObject



  • Try to create a java class from c++ side but keep crashing

    appBucksAdv.java
    @
    package adv;

    import org.qtproject.qt5.android.bindings.QtApplication;
    import org.qtproject.qt5.android.bindings.QtActivity;

    import android.os.Bundle;

    public class appBucksAdv extends QtActivity
    {
    }

    @

    simpleJNI.hpp
    @
    #include <QObject>
    #include <QtAndroidExtras/QAndroidJniObject>

    class simpleJNI : public QObject
    {
    Q_OBJECT
    public:
    explicit simpleJNI(QObject *parent = nullptr);

    private:
    QAndroidJniObject advClass_;

    };
    @

    simpleJNI.cpp
    @
    #include "simpleJNI.hpp"

    simpleJNI::simpleJNI(QObject *parent) :
    QObject(parent),
    advClass_("adv/appBucksAdv") //crash when I create the java class
    {
    }
    @

    "error messages":http://pastebin.com/D1ZWJ53s

    "codes":https://github.com/stereomatchingkiss/blogCodes2/tree/master/androidTest



  • I faced a similar issue, instead I edited the generated Java code


Log in to reply