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. Dynamic libs on Android with Qt5.14.2
QtWS25 Last Chance

Dynamic libs on Android with Qt5.14.2

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
dynamic linkingandroidqt5.14.2
7 Posts 2 Posters 2.4k Views
  • 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.
  • K Offline
    K Offline
    koahnig
    wrote on 19 Apr 2020, 16:45 last edited by
    #1

    My application is using dynamic link libraries on Android. The libraries are compiled in a separate project and added in the .pro file with a ANDROID_EXTRA_LIBS statement. Up to Qt5.12.7 the libraries were added into the apk file. Now with Qt5.14.2 this is no longer the case. The application is crashing when started on Android.

    Is there a different way to add the dynamic link libraries under Android for Qt5.14.2 ?

    Vote the answer(s) that helped you to solve your issue(s)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 1 May 2020, 07:29 last edited by
      #2

      ANDROID_EXTRA_LIBS should still work.

      Some things which may help:

      • regenerate Android templates in Qt Creator (Qt 5.14 updates the templates significantly, old ones do not work anymore!)
      • search your whole source code for ANDROID_EXTRA_LIBS . I once had a case where Qt Creator automatically inserted ANDROID_EXTRA_LIBS= (variable was emptied!) into my .pro file. So I thought I had everything fine, libs added, but actually the .pro file was removing the libs I set earlier :-)
      • if all else fails, you can try adding the extra libs through Qt Creator's manifest editor form (double click on your AndroidManifest.xml in QtC)

      (Z(:^

      K 1 Reply Last reply 17 May 2020, 08:56
      0
      • S sierdzio
        1 May 2020, 07:29

        ANDROID_EXTRA_LIBS should still work.

        Some things which may help:

        • regenerate Android templates in Qt Creator (Qt 5.14 updates the templates significantly, old ones do not work anymore!)
        • search your whole source code for ANDROID_EXTRA_LIBS . I once had a case where Qt Creator automatically inserted ANDROID_EXTRA_LIBS= (variable was emptied!) into my .pro file. So I thought I had everything fine, libs added, but actually the .pro file was removing the libs I set earlier :-)
        • if all else fails, you can try adding the extra libs through Qt Creator's manifest editor form (double click on your AndroidManifest.xml in QtC)
        K Offline
        K Offline
        koahnig
        wrote on 17 May 2020, 08:56 last edited by
        #3

        @sierdzio

        Sorry took me a while toget back to the issue.

        On Build Android APK the libraries are shown under "Additional libraries". However, still no success.

        @sierdzio said in Dynamic libs on Android with Qt5.14.2:

        • if all else fails, you can try adding the extra libs through Qt Creator's manifest editor form (double click on your AndroidManifest.xml in QtC)

        How do you mean that? The mask does not allow to add libraries. At least it is not obvious to me.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on 17 May 2020, 12:00 last edited by
          #4

          The question is my previous post is still unclear.

          However, I made some progress to get ANDROID_EXTRA_LIBS to work.
          Nevertheless , I cannot believe what I see.

          When setting the variable directly with the accurate absolute path, it does not work.
          When using $$PWD which will result into the same absolute path it does work.

          When assembling the variable using some decisions, it does not work.
          When setting the variable within the same decision, it does not work. Even when using the exact statement as when it works outside of decisions.

          No logic at the moment.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 17 May 2020, 12:57 last edited by
            #5

            After fighting with libs again in a new project, I've found another working, although quirky, solution:

            Use the android/libs dir to store the built libs. These are all automatically copied to the APK and there is no need to adjust any paths in the .pro or cmake files. https://doc.qt.io/qt-5/deployment-android.html#libraries

            (Z(:^

            K 1 Reply Last reply 18 May 2020, 09:20
            3
            • S sierdzio
              17 May 2020, 12:57

              After fighting with libs again in a new project, I've found another working, although quirky, solution:

              Use the android/libs dir to store the built libs. These are all automatically copied to the APK and there is no need to adjust any paths in the .pro or cmake files. https://doc.qt.io/qt-5/deployment-android.html#libraries

              K Offline
              K Offline
              koahnig
              wrote on 18 May 2020, 09:20 last edited by
              #6

              @sierdzio

              Thanks for reply.

              Certainly I have a solution. However, the situation is not really satisfactory. I was trying to get the project recompilable through qmake for different Qt versions. Apparently not possible at least with qmake.

              I am wondering if it is easier with using cmake?

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sierdzio
                Moderators
                wrote on 18 May 2020, 10:31 last edited by
                #7

                Trick with android/libs should work for older Qt versions, too, and it works the same on qmake and cmake. If all else fails, you could have different .pri per Qt version... It's a nuisance for sure but my hope is that for Qt 5.14+ it will stay as it is for long.

                (Z(:^

                1 Reply Last reply
                1

                • Login

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