Environment: android, C++, Qt 5.15.2, mostly Qt Widgets, a bit of QML and QZXing for QR support.
I used to work with cmake but the AndroidManifest.xml support is still very weak, so I moved back to qmake.
My application worked with cmake (but without the icon, and permissions set by hand).
My qmake file is:
TEMPLATE = app
CONFIG += c++17
INCLUDEPATH += xxx xxxqzxingsrc
CONFIG += qzxing_multimedia
enable_encoder_qr_code
enable_decoder_1d_barcodes
enable_decoder_qr_code
enable_decoder_data_matrix
enable_decoder_aztec
enable_decoder_pdf17
CONFIG(debug, debug|release) {
CONFIG+=qml_debug
} else {
DEFINES += QT_NO_DEBUG
DEFINES += QT_NO_DEBUG_OUTPUT
}
DEFINES += ENABLE_ENCODER_GENERIC QZXING_QML
FORMS = cmainwindow.ui ...
SOURCES = cmainwindow.cpp ...
HEADERS = cmainwindow.h ...
SOURCES += main.cpp
RESOURCES += main.qrc
QT += gui core widgets quick quickwidgets qml purchasing network sql multimedia multimediawidgets
android {
SOURCES += ...
HEADERS += ...
LIBS += -ljnigraphics
}
include( qzxing/src/QZXing-components.pri)
# Default rules for deployment.
include(deployment.pri)
android {
QT += androidextras
DISTFILES +=
android/AndroidManifest.xml
android/gradle/wrapper/gradle-wrapper.jar
android/gradlew
android/res/values/libs.xml
android/build.gradle
android/gradle/wrapper/gradle-wrapper.properties
android/gradlew.bat
android/AndroidManifest.xml
android/gradle/wrapper/gradle-wrapper.jar
android/gradlew
android/res/values/libs.xml
android/build.gradle
android/gradle/wrapper/gradle-wrapper.properties
android/gradlew.bat
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
}
When I run it on an android device I get: "Your application encountered a fatal error and can not continue" (translated from French)
In the logs:
E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: org.xxx.yyy, PID: 16075
E xxx.yyy: No implementation found for void org.qtproject.qt5.android.QtNative.handleOrientationChanged(int, int) (tried Java_org_qtproject_qt5_android_QtNative_handleOrientationChanged and Java_org_qtproject_qt5_android_QtNative_handleOrientationChanged__II)
handleOrientationChanged declaration is in QtNative.java:
public class QtNative
{
…
public static native void handleOrientationChanged(int newRotation, int nativeOrientation);
…
}
As far as I understand (I’m not a Java specialist), the definition of this (native) method or function is in androidjnimain.cpp:
static void handleOrientationChanged(JNIEnv */*env*/, jobject /*thiz*/, jint newRotation, jint nativeOrientation)
{
...
}
So, if I understand well: "No implementation found…" means that the declaration in Java is found but either androidjmain.cpp is not included in the apk file, or Java doesn’t find his to the implementation (linker issue?). Maybe is related to some SDK API version mismatch?
I look for example at the QZXingLive Qt5/C++/QZXing example and didn’t find any meaningful difference related to either the compilation or the deployment.
Question: What should I look at to solve this?
Source: Windows Questions C++