[Solved] Need guide for running app in Android (real or simulator)



  • Hi all,
    I'm trying to run my very first Qt Quick 2 app in Android, but so far to no avail. After correct compilation and (as it seems) a correct deployment of the APK file, the application doesn't launch and an error is shown in the Qt Creator "Application Output". I'd really appreciate a bit of help sorting this out, as I'm experienced Qt developer but have next to zero knowledge of Android development and deployment of apps.

    I followed instructions from these two sites:
    http://qt-project.org/doc/qt-5.1/qtdoc/android-support.html
    and
    http://qt-project.org/doc/qtcreator-2.7/creator-developing-android.html

    These are some lines from the output. I could put the complete log (about 40 lines) if needed:
    D/dalvikvm( 1081): No JNI_OnLoad found in /data/data/org.qtproject.example.GraphEd/lib/libgnustl_shared.so 0x41491540, skipping init
    D/dalvikvm( 1081): No JNI_OnLoad found in /data/data/org.qtproject.example.GraphEd/lib/libQt5Core.so 0x41491540, skipping init
    D/dalvikvm( 1081): No JNI_OnLoad found in /data/data/org.qtproject.example.GraphEd/lib/libQt5V8.so 0x41491540, skipping init
    D/dalvikvm( 1081): No JNI_OnLoad found in /data/data/org.qtproject.example.GraphEd/lib/libQt5Gui.so 0x41491540, skipping init
    ... (similar lines for each Qt library file)
    D/dalvikvm( 1081): No JNI_OnLoad found in /data/data/org.qtproject.example.GraphEd/lib/libGraphEd.so 0x41491540, skipping init
    W/Qt ( 1081): ../src/androidjnimain.cpp:449 (jboolean startQtApplication(JNIEnv*, jobject, jstring, jstring)): Can't set environment ""
    W/Qt ( 1081): kernel/qcoreapplication.cpp:412 (QCoreApplicationPrivate::QCoreApplicationPrivate(int&, char**, uint)): WARNING: QApplication was not created in the main() thread.
    ...
    E/EGL_emulation( 1081): tid 1104: eglSwapInterval(844): error 0x3006 (EGL_BAD_CONTEXT)
    W/dalvikvm( 1081): dvmFindClassByName rejecting 'org/qtproject/qt5/android/QtNativeInputConnection'
    W/dalvikvm( 1081): dvmFindClassByName rejecting 'org/qtproject/qt5/android/QtExtractedText'

    Seems that OpenGL emulation is the problem...

    Things I have done:

    • Installed latest Qt 5.1 SDK on Ubuntu 12.04 64 bit.
    • Configured Qt Creator as explained in the web instructions. Current Android SDK & NDK as of 2 days ago.
    • Created a new Android Virtual Device (AVD), configured as "Galaxy Nexus", target API Level 16 (Android 4.1.2), with 1024 MB RAM, 64 MB VM Heap, and tried either enabling & disabling the "Use Host GPU" option.
    • Created a new project.
      In project options -> Package configurations, I let it "Read information from application" to choose the Required Qt libraries.
    • In project options -> Deploy configurations, I didn't touch the default selection: "Use Qt libraries from device" and "Use local Qt libraries".
    • I didn't touch any of the files which Qt Creator generated under the "android" folder inside the project folder.

    I tried to be very specific, sorry if my post got too large...
    Any help would be much appreciated :)



  • You can find the complete source code of my sample project in here:
    https://github.com/juannm/playground/tree/master/GraphEd

    It's a first contact test with QML + JavaScript code, neither of which I've used before.



  • Have you only tried to use it on the emulator yet?

    Since its running fine on my real device

    Btw, opengl on the android emulator has never been of any use.



  • [quote author="Moster" date="1373370824"]Have you only tried to use it on the emulator yet?

    Since its running fine on my real device

    Btw, opengl on the android emulator has never been of any use.[/quote]

    OK, problem solved. Not sure what changed, maybe the very action of writing this post made me to be more careful about what to do, but now after having it working in my device, it also works in the emulator.

    What I did change was using "Deploy" instead of "Run" in Qt Creator.

    Also, by running the emulator in the console, I found out this error message:
    @
    emulator: ERROR: Could not load OpenGLES emulation library: libOpenglRender.so: cannot open shared object file: No such file or directory
    emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
    @

    which happens because the path to libOpenglRender.so must be added to the LD_LIBRARY_PATH variable.
    I don't know it this makes any difference at all; if so, maybe it should be noted in the instructions given in the web.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.