尝试从 c++ 端创建一个 java 类,但不断崩溃
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
{
}
简单JNI.hpp
#include <QObject>
#include <QtAndroidExtras/QAndroidJniObject>
class simpleJNI : public QObject
{
Q_OBJECT
public:
explicit simpleJNI(QObject *parent = nullptr);
private:
QAndroidJniObject advClass_;
};
简单JNI.cpp
#include "simpleJNI.hpp"
simpleJNI::simpleJNI(QObject *parent) :
QObject(parent),
advClass_("adv/appBucksAdv") //crash when I create the java class
{
}
错误消息:# W/dalvikvm(21397): dvmFindClassByName 拒绝 'org/qtproject/qt5/android/QtMessageDialogHelper'
# D/dalvikvm(21397): 试图加载 lib /data/data/org.qtproject.example.androidTest/lib/libQt5QuickParticles.so 0x4176efd0
# D/dalvikvm(21397): Shared lib '/data/data/org.qtproject.example.androidTest/lib/libQt5QuickParticles.so' 已经加载到同一个 CL 0x4176efd0
# D/dalvikvm(21397): 试图加载 lib /data/data/org.qtproject.example.androidTest/lib/libandroidTest.so 0x4176efd0
# D/dalvikvm(21397): 添加共享库 /data/data/org.qtproject.example.androidTest/lib/libandroidTest.so 0x4176efd0
# D/dalvikvm(21397): No JNI_OnLoad found in /data/data/org.qtproject.example.androidTest/lib/libandroidTest.so 0x4176efd0,跳过初始化
# W/Qt (21397): kernel/qcoreapplication.cpp:416 (QCoreApplicationPrivate::QCoreApplicationPrivate(int&, char**, uint)): WARNING: QApplication 不是在 main() 线程中创建的。
# W/dalvikvm(21397): dvmFindClassByName 拒绝 'org/qtproject/qt5/android/QtNativeInputConnection'
# W/dalvikvm(21397): dvmFindClassByName 拒绝 'org/qtproject/qt5/android/QtExtractedText'
1.完整的消息
2.代码