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: how to use local libraries
QtWS25 Last Chance

Android: how to use local libraries

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
androidc++librarypath
10 Posts 4 Posters 1.3k 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
    KroMignon
    wrote on 25 Jul 2019, 08:18 last edited by
    #1

    Hi all,

    maybe a seely question, but I want to know if it is possible to use a locally available C++ library with Qt for Android?

    I've got some huge libraries which are stored somewhere in the internal storage of my Android device (/sdcard/myLibs/).
    I don't want to add those libraries in the APK, is it possible to define a kind of "extra libraries path"?

    Thanks for any suggestion

    Fabrice

    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

    J T 2 Replies Last reply 25 Jul 2019, 08:26
    0
    • K KroMignon
      25 Jul 2019, 08:18

      Hi all,

      maybe a seely question, but I want to know if it is possible to use a locally available C++ library with Qt for Android?

      I've got some huge libraries which are stored somewhere in the internal storage of my Android device (/sdcard/myLibs/).
      I don't want to add those libraries in the APK, is it possible to define a kind of "extra libraries path"?

      Thanks for any suggestion

      Fabrice

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 25 Jul 2019, 08:26 last edited by
      #2

      @KroMignon said in Android: how to use local libraries:

      I don't want to add those libraries in the APK

      Why not? If your app is linked against these libs your APK will not work without them.
      Or do you load these libs dynamically at runtime?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply 25 Jul 2019, 08:38
      1
      • J jsulm
        25 Jul 2019, 08:26

        @KroMignon said in Android: how to use local libraries:

        I don't want to add those libraries in the APK

        Why not? If your app is linked against these libs your APK will not work without them.
        Or do you load these libs dynamically at runtime?

        K Offline
        K Offline
        KroMignon
        wrote on 25 Jul 2019, 08:38 last edited by
        #3

        @jsulm said in Android: how to use local libraries:

        Why not?

        Because I want to reduce APK size. Do I need to have all libs I use in the APK, is there no way to have "shared libraries" between APKs?

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        J 1 Reply Last reply 25 Jul 2019, 08:41
        0
        • K KroMignon
          25 Jul 2019, 08:38

          @jsulm said in Android: how to use local libraries:

          Why not?

          Because I want to reduce APK size. Do I need to have all libs I use in the APK, is there no way to have "shared libraries" between APKs?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 25 Jul 2019, 08:41 last edited by
          #4

          @KroMignon The problem I see: APK will not work without these libs, so how are you going to distribute your apps? I'm not an expert but I'm quite sure this is not supported by Android because of security: apps can only execute what is part of APK and nothing else (sandbox).

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 1 Reply Last reply 25 Jul 2019, 10:32
          0
          • J jsulm
            25 Jul 2019, 08:41

            @KroMignon The problem I see: APK will not work without these libs, so how are you going to distribute your apps? I'm not an expert but I'm quite sure this is not supported by Android because of security: apps can only execute what is part of APK and nothing else (sandbox).

            K Offline
            K Offline
            KroMignon
            wrote on 25 Jul 2019, 10:32 last edited by
            #5

            @jsulm It is a fully custom application, for customize hardware. It not has to be distributed to "the world" or to any app store. My goal is to be able to reduce APK size for on-line updates

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            J 1 Reply Last reply 25 Jul 2019, 10:52
            0
            • K KroMignon
              25 Jul 2019, 10:32

              @jsulm It is a fully custom application, for customize hardware. It not has to be distributed to "the world" or to any app store. My goal is to be able to reduce APK size for on-line updates

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 25 Jul 2019, 10:52 last edited by
              #6

              @KroMignon OK, understand.
              I'm not sure this is possible with not rooted devices because of sandboxing, but I'm not expert.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • K KroMignon
                25 Jul 2019, 08:18

                Hi all,

                maybe a seely question, but I want to know if it is possible to use a locally available C++ library with Qt for Android?

                I've got some huge libraries which are stored somewhere in the internal storage of my Android device (/sdcard/myLibs/).
                I don't want to add those libraries in the APK, is it possible to define a kind of "extra libraries path"?

                Thanks for any suggestion

                Fabrice

                T Offline
                T Offline
                Tom_H
                wrote on 25 Jul 2019, 20:33 last edited by
                #7

                @KroMignon You should be able to do it the same way that Ministro does it. The libraries have to be in a readable location. I think Ministro puts the Qt libraries in /data/local/tmp/qt, but anywhere under /data should work. Then you would have to dynamically load them. I don't think /sdcard/myLibs would work.

                S 1 Reply Last reply 25 Jul 2019, 21:13
                0
                • T Tom_H
                  25 Jul 2019, 20:33

                  @KroMignon You should be able to do it the same way that Ministro does it. The libraries have to be in a readable location. I think Ministro puts the Qt libraries in /data/local/tmp/qt, but anywhere under /data should work. Then you would have to dynamically load them. I don't think /sdcard/myLibs would work.

                  S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 25 Jul 2019, 21:13 last edited by
                  #8

                  @Tom_H said in Android: how to use local libraries:

                  @KroMignon You should be able to do it the same way that Ministro does it. The libraries have to be in a readable location. I think Ministro puts the Qt libraries in /data/local/tmp/qt, but anywhere under /data should work. Then you would have to dynamically load them. I don't think /sdcard/myLibs would work.

                  The problem is that recent version of Android disabled the access to such shared folder so it can't be used anymore.

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

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    KroMignon
                    wrote on 26 Jul 2019, 07:09 last edited by
                    #9

                    @Tom_H @SGaist , thanks a lot for your suggestions.
                    In fact, the hardware I am targeting is rooted. I could copy Qt files anywhere but I don't really know what is the right way to do it.
                    It is based on Android 7.0 (Nougat).

                    Perhaps is using/customizing Ministro the best way?

                    It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                    J 1 Reply Last reply 26 Jul 2019, 07:12
                    0
                    • K KroMignon
                      26 Jul 2019, 07:09

                      @Tom_H @SGaist , thanks a lot for your suggestions.
                      In fact, the hardware I am targeting is rooted. I could copy Qt files anywhere but I don't really know what is the right way to do it.
                      It is based on Android 7.0 (Nougat).

                      Perhaps is using/customizing Ministro the best way?

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 26 Jul 2019, 07:12 last edited by
                      #10

                      @kromignon Since Android is based on Linux you could put the libs in /usr/lib and see whether it works.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      3/10

                      25 Jul 2019, 08:38

                      topic:navigator.unread, 7
                      • Login

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