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. Android System app - "libqtforandroid.so" loading issue.
Forum Updated to NodeBB v4.3 + New Features

Android System app - "libqtforandroid.so" loading issue.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 3 Posters 4.3k Views 2 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.
  • abygmA Offline
    abygmA Offline
    abygm
    wrote on last edited by
    #1

    Hi,

    I have added a sample to AOSP package/apps to make it as a system app. After build and flash, I can see the app as system app; but it is throwing fatal error..!

    From Logcat I could see, 'libqtforandroid.so' is '0' size. I verified path (/data/data/lm.ep.sysapptest/qt-reserved-files/plugins/platforms/android/) it is indeed '0' size.

    I made a copy of the project with slightly different package name, and installed it on the same device, which is working fine. 'libqtforandroid.so' is present in path with 653492 bytes size.

    I copied this 'libqtforandroid.so' non working app path and replaced the zero bytes file and tried to load the app. Again fatal error..! Now I could see a different error in logcat: 'dlopen("/data/data/lm.ep.sysapptest/qt-reserved-files/plugins/platforms/android/libqtforandroid.so", RTLD_LAZY) failed: dlopen failed: "/data/data/lm.ep.sysapptest/qt-reserved-files/plugins/platforms/android/libqtforandroid.so" is 32-bit instead of 64-bit'

    I recompiled Android with LOCAL_MULTILIB := 32 parameter. No luck..

    Request to throw some light into this issue.

    My objective is to make Qt app as system app in Android.

    Thanks in advance,

    Aby.

    1 Reply Last reply
    0
    • abygmA Offline
      abygmA Offline
      abygm
      wrote on last edited by
      #2

      Issue Resolved.

      I missed once crucial step when adding app to AOSP: missed copying all the .so files from qt build folder to AOSP/../packages/apps/<my-app> folder and adding to .mk file.

      Once this is done and build, system app is working fine.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Glad you found out and thanks for sharing !

        Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        abygmA 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          Glad you found out and thanks for sharing !

          Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

          abygmA Offline
          abygmA Offline
          abygm
          wrote on last edited by
          #4

          @SGaist I later realised that the issue is not fully solved.. I am marking it as unsolved. I would add the details of the issue.

          1 Reply Last reply
          0
          • abygmA Offline
            abygmA Offline
            abygm
            wrote on last edited by
            #5

            An Update:

            Initial problem I faced in making a qt app as system app was about missing libraries.
            The process I followed is:

            1. Made an .apk using qtCreator. (& tested the .apk as a user app in android device)
            2. Copied .apk to AOSP/packages/apps/my_app folder
            3. Created a minimum Android.mk file.
            4. Compiled AOSP and flashed device.

            MyApp icon appeared in app drawer, but on first run it is not able to install properly, as libraries are not found.
            I solved the issue by copying all the .so files from my android-build/libs folder to AOSP/packages/apps/lib folder, and making corresponding entries in Android.mk file. Now my system app is properly installed.. and running fine..

            BUT I later realised a major flow. I was doing all the testing on a android eng build with SELinux disabled. The moment I did a user build, my app stopped working.. After some research, the conclusion I have arrived at is as follows:

            1. All the .so files are in /data/data<my_app>/qt-reserved-files/plugins folder. SELinux security policy does not allow loading libraries from /data/data.
            2. A copy of all these .so files are available in /system/app/<myapp>/lib/arm folder; but with long names. (i.e, plugins/platforms/libqminimal.so is available as libplugins_platforms_libqminimal.so)
            3. /data/system/packages.xml has entry nativeLibraryPath="/system/app/<myapp>/lib". Still qt is trying to load libraries from /data/data.

            How to configure qt to load libraries from "/system/app/<myapp>/lib" folder rather than /data/data/qt-reserved-files folder ? Will the long-file-names create a problem in loading the libraries ?

            Thanks in advance for the help.

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              zuzoid
              wrote on last edited by zuzoid
              #6

              You can use this patchset as a temporary solution: https://codereview.qt-project.org/194507
              Al libraries from android-build/libs/<arch> must be deployed at /system/lib folder on device (or firmware before it built)

              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