Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using a Qt based library in an android app
Forum Updated to NodeBB v4.3 + New Features

Using a Qt based library in an android app

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 4 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dualfaces
    wrote on last edited by
    #1

    Hi,

    i have a library which is based on Qt 5. I built it for armeabi to get a shared library.
    The Anroid application has an jni part which involves the Library. Therefore i have a folder "lib" in my project root. There the library libmylib.so is placed in armeabi/libmylib.so.
    In the folder "jni" contained in the app root i have a folder libmylib in which an Android.mk is placed:
    @
    LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)

    LOCAL_MODULE := mylib
    LOCAL_SRC_FILES := ../../lib/armeabi/libmylib.so
    LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc

    include $(PREBUILT_SHARED_LIBRARY)
    @

    The Android.mk placed in jni contains
    @
    LOCAL_SHARED_LIBRARIES :=
    mylib
    $(call import-module, mylib)
    @

    Running ndk-build works fine and copies the libraries to libs/armeabi.
    In my MainActivity i call
    @System.loadLibrary("mylib")@
    This all works good, but i also need Qt5Core.so, which is involved the same way. But while loading Qt5Core the application crashes with
    @UnsatisfiedLinkError: Unknown Failure@

    Is there a better way to get the qt libraries to the android device? Next to the fact that a library project does not generate the necessary libraries, i needed to turn the library into a small application which was deployed to the device. Now Qt created a folder android-builds which contained all those libraries.
    I copied these as necessary to my android application, but as said, as soon as i try to load qt5core it crashes.

    Is it possible to build mylib such that it contains all required information and i only need to add one library?

    Thank you!

    Kind Regards!

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dualfaces
      wrote on last edited by
      #2

      no ideas how to build a standalone library?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        angalpin
        wrote on last edited by
        #3

        I'm also attempting the same thing - hopefully someone can enlighten both of us.

        dualfaces, I made some headway by statically compiling Qt. If you don't need to create a QGuiApplication object, this might be enough for you. I'm stuck on creating the QGuiApplication object because it can't find the android platform library, even though I have packaged it into my APK.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kalpa
          wrote on last edited by
          #4

          Dear friends!

          I found this situation in my project and did't find any solutions.

          Something new in this case?

          Oleg Shalnev

          1 Reply Last reply
          0
          • R Offline
            R Offline
            Rjjp
            wrote on last edited by
            #5

            Same issue here!

            Is it a bug of libQt5Core.so?? Maybe we could include the code files in ours libraries instead of reference libQt5Core...

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved