Nominate our 2022 Qt Champions!

Using Qt within an Android Native.Activity project in Visual Studio 2015 / 2017

  • How do I use Qt in an Android NativeActivity project in Visual Studio 2015 or 2017.

    I am having link issues.

    I am trying code like below. But obviously, there must be a cleaner approach.

    Any one has an example? and can describe steps for integrating Qt into android_main(struct android_app* state)

    Please help show how to integrate Qt into

    * This is the main entry point of a native application that is using
    * android_native_app_glue. It runs in its own thread, with its own
    * event loop for receiving input events and doing other things.
    void android_main(struct android_app* state) {
    int argc = 0;
    char* argv[] = {};
    QApplication a(argc, argv);

    And also even when I comment out my code. And specify, for instance Qt5Location;Qt5Positioning; in Library dependencies,
    the application crash in the emulator even before ANativeActivity_onCreate is called. I suspect the Qt shared libraries are not being copied over and loaded on the emulator or device.

    Please help elucidate.

  • Lifetime Qt Champion


    That's a question you should bring to the Qt Android mailing list. You'll find there Qt's Android port developers/maintainers. This forum is more user oriented.

  • @SGaist
    Thanks SGaist. I ll check that mailing list as well

  • Moderators

    The usual approach to JNI and Qt is to store the Java classes in android dir, and not to use android_main. Rather, Qt is responsible for bootstrapping the Android app, creating the event loop etc. and only then Java is accessed by JNI.

    This is somewhat explained here and also in a splendid series of posts by BogDan (the creator of Qt on Android):

Log in to reply