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

Using vendor-supplied JAR file with Necessitas



  • Hi,
    I'm writing an application with Necessitas in Qt Creator, and need to use a vendor-supplied Jar file in order to access the serial port of the Android device. However, I'm not sure how to include the Jar file in the project so that I can use it, because when I use the following code:

    @JavaVM* currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
    

    currVM->GetEnv( (void**)&env, JNI_VERSION_1_6);
    jclass cls = 0;
    cls = env->FindClass("com/vendor/SerialPort");
    env->ExceptionDescribe();@

    To try and get a reference to the appropriate Java class, it fails to do so, giving this message from ExceptionDescribe() : W/System.err( 2116): java.lang.NoClassDefFoundError: [generic] at dalvik.system.NativeStart.main(Native Method)

    If I try any other Java or Android class, it works correctly, so obviously I need to do something else to make the JAR available to my project when using Qt Creator - Does anybody know what? There’s plenty of information on how to do this with Eclipse, but I haven’t been able to make this work with Qt Creator at all.


Log in to reply