Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. QMYSQL working on Windows and Mac but not Android
QtWS25 Last Chance

QMYSQL working on Windows and Mac but not Android

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
21 Posts 4 Posters 6.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.
  • L LeeH

    @jsulm Hi, I am new to this area of Qt lol... so I did a search for 'libmysql.so' but only have 'libmysql.dll' and 'libmysql.lib' on my computer. Is this missing file the reason??? I do not recall needing it before... i dunno

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @LeeH You always need it - it is the actual interface to MySQL and is used by Qt MySQL plug-in.
    'libmysql.dll' and 'libmysql.lib' - this is for Windows, you need one for Android.

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

    L 1 Reply Last reply
    1
    • jsulmJ jsulm

      @LeeH You always need it - it is the actual interface to MySQL and is used by Qt MySQL plug-in.
      'libmysql.dll' and 'libmysql.lib' - this is for Windows, you need one for Android.

      L Offline
      L Offline
      LeeH
      wrote on last edited by
      #7

      @jsulm ah ok, so could you please tell me how to get it? What I don't understand is why it all worked on my previous installation, and why/where things have gone wrong here...

      jsulmJ 1 Reply Last reply
      0
      • L LeeH

        @jsulm ah ok, so could you please tell me how to get it? What I don't understand is why it all worked on my previous installation, and why/where things have gone wrong here...

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @LeeH The correct name is actually libmysqlclient.so, I don't know why it worked for you before.
        Maybe this can help: https://wiki.qt.io/Build_Qt_5_MySQL_Plugin_for_Android

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

        L 1 Reply Last reply
        1
        • jsulmJ jsulm

          @LeeH The correct name is actually libmysqlclient.so, I don't know why it worked for you before.
          Maybe this can help: https://wiki.qt.io/Build_Qt_5_MySQL_Plugin_for_Android

          L Offline
          L Offline
          LeeH
          wrote on last edited by
          #9

          @jsulm thanks for that post but I had seen that page way back when I first had problems building the mysql driver on windows. It didn't make sense to me then, and it doesn't now tbh, but I did get it to work perfectly without that. Maybe I should reinstall the android sdk's? It seems like its just a deployment to android issue, but I am open to any new suggestions... cheers

          1 Reply Last reply
          0
          • raven-worxR raven-worx

            @LeeH
            you can use qputenv("QT_DEBUG_PLUGINS", "1") before creating a QApplication instance and check the output. It might give some hints what is failing.

            IIRC the mysql plugin also links against mysql lib. So did you also deploy this one?

            L Offline
            L Offline
            LeeH
            wrote on last edited by LeeH
            #10

            @raven-worx Hi, I put:

            qDebug() << qputenv("QT_DEBUG_PLUGINS", "1"); 
            QApplication app(argc, argv);
            

            and in the android log it return 'true'

            ...
            D         : ..\test\main.cpp:31 (int main(int, char**)): true
            ...
            

            Is this what you meant? Is it doing what it's supposed to? Did I make a mistake?
            '

            raven-worxR 1 Reply Last reply
            0
            • L LeeH

              @raven-worx Hi, I put:

              qDebug() << qputenv("QT_DEBUG_PLUGINS", "1"); 
              QApplication app(argc, argv);
              

              and in the android log it return 'true'

              ...
              D         : ..\test\main.cpp:31 (int main(int, char**)): true
              ...
              

              Is this what you meant? Is it doing what it's supposed to? Did I make a mistake?
              '

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by raven-worx
              #11

              @LeeH said in QMYSQL working on Windows and Mac but not Android:

              Is this what you meant?

              no, not what this command returns.
              With this env variable set Qt should print some debug info of the plugin loading process.

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              L 1 Reply Last reply
              0
              • raven-worxR raven-worx

                @LeeH said in QMYSQL working on Windows and Mac but not Android:

                Is this what you meant?

                no, not what this command returns.
                With this env variable set Qt should print some debug info of the plugin loading process.

                L Offline
                L Offline
                LeeH
                wrote on last edited by
                #12

                @raven-worx ok - but there is a lot of information here, and I don't know what I'm looking for, I can't see anything about debug for plugins.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  LeeH
                  wrote on last edited by
                  #13

                  @raven-worx Hi, I think I've managed to find the additional info that 'qputenv("QT_DEBUG_PLUGINS", "1");' provides. I hope it's what you meant but here it is:

                  W libtest.so: (null):0 ((null)): Found metadata in lib /data/data/org.qtproject.example.test/qt-reserved-files/plugins/sqldrivers/libqsqlite.so, metadata=
                  W libtest.so: {
                  W libtest.so:     "IID": "org.qt-project.Qt.QSqlDriverFactoryInterface",
                  W libtest.so:     "MetaData": {
                  W libtest.so:         "Keys": [
                  W libtest.so:             "QSQLITE"
                  W libtest.so:         ]
                  W libtest.so:     },
                  W libtest.so:     "className": "QSQLiteDriverPlugin",
                  W libtest.so:     "debug": false,
                  W libtest.so:     "version": 329985
                  W libtest.so: }
                  

                  Thanks

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

                    Hi,

                    It confirms that only the SQLite plugin is available for android.

                    IIRC, you can now find more information about how to use QtWidget and custom plugins altogether.

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

                    L 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Hi,

                      It confirms that only the SQLite plugin is available for android.

                      IIRC, you can now find more information about how to use QtWidget and custom plugins altogether.

                      L Offline
                      L Offline
                      LeeH
                      wrote on last edited by
                      #15

                      @SGaist Hi, thanks for your reply. I am really stuck and confused here because as I mentioned in earlier post I did not need to build the android driver seperately before, I just installed mysql software from their site and loaded the windows mysql driver and mysql worked from windows and android perfectly, Might sound silly but I've tried uninstalling and reinstalling mysql community software in a hope to try to replicate what I did before. but no luck. If I do need to build it manually this time, then the info here: https://wiki.qt.io/Build_Qt_5_MySQL_Plugin_for_Android (I assume I need option 3) but is even more confusing at this moment because option 3 appears to be incomplete. What can I do? Thanks.

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

                        Then please, show that earlier version that worked. Oracle doesn't provide any official driver for Android otherwise the Qt SDK would be offered with that plugin already built.

                        Option 3 is not incomplete, it's not there as it's written it's a stub.

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

                        L 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Then please, show that earlier version that worked. Oracle doesn't provide any official driver for Android otherwise the Qt SDK would be offered with that plugin already built.

                          Option 3 is not incomplete, it's not there as it's written it's a stub.

                          L Offline
                          L Offline
                          LeeH
                          wrote on last edited by LeeH
                          #17

                          @SGaist Hi again, sorry not earlier version of mysql server community software as that was and is 5.7. I meant Qt version 5.8 is when everything just worked, so Ive been back and forth between Qt 5.8 and 5.9.1. However when I have returned to Qt 5.8 android dosen't build at all, there are no sdk's available in my android build apk area even though they are installed. I also have sdk tools 25.2.5. But in Qt 5.9.1 These problems don't exist and android builds fine, but complains about the mysql driver... I'm loosing my mind!

                          1 Reply Last reply
                          0
                          • L Offline
                            L Offline
                            LeeH
                            wrote on last edited by
                            #18

                            I think I know where I messed up. I'm not sure, but I need to sort it out when I get more time... Thanks to you all for your help so far. Hopefully I should get this sorted.

                            1 Reply Last reply
                            0
                            • L Offline
                              L Offline
                              LeeH
                              wrote on last edited by
                              #19

                              I thought I did something wrong but after correcting that it didn't make a difference... Anyway I have accepted that how it worked before is gone , so I need to build it myself. I have now got MSYS installed and that appears to work:

                              MSYS 1.0.11
                              MSYS DTK 1.0
                              MSYS Core 1.0.11

                              I am now trying to work through option 2 https://wiki.qt.io/Build_Qt_5_MySQL_Plugin_for_Android. Before running the script, I edit these lines:

                              from

                              output_dir="libmariadb_so_output"
                              build_dir="build_libmariadb_temp"
                              
                              export ANDROID_NDK_ROOT="/d/SDKs/Android/ndk-bundle"
                              export QT_ROOT="/d/SDKs/Qt/5.7"
                              
                              SR="$ANDROID_NDK_ROOT/platforms/android-17/arch-arm/"
                              BR="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi- 4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"
                              

                              to

                              output_dir="/c/android_output"
                              build_dir="build_libmariadb_temp"
                              
                              export ANDROID_NDK_ROOT="/c/android-ndk-r15b"
                              export QT_ROOT="/c/Qt/5.9"
                              
                              SR="$ANDROID_NDK_ROOT/platforms/android-21/arch-arm"
                              BR="$ANDROID_NDK_ROOT/toolchains/aarch64-linux-android-4.9/prebuilt/windows/bin/aarch64-linux-android-gcc-4.9"
                              

                              I leave everything else as it is then run the script. At the end I get:

                              sh: !": event not found
                              

                              Then check in the output directory I set for the .so file and file is not there. I have never used MSYS before, I'm just trying to follow steps on wiki page option 2... thanks

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

                                Like I already wrote, no Qt release was provided with MySQL driver for Android since there's no official client library for that platform.

                                As for the error you got, it seems related to the sh interpreter, you should look up for that.

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

                                L 1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  Like I already wrote, no Qt release was provided with MySQL driver for Android since there's no official client library for that platform.

                                  As for the error you got, it seems related to the sh interpreter, you should look up for that.

                                  L Offline
                                  L Offline
                                  LeeH
                                  wrote on last edited by
                                  #21

                                  @SGaist Thanks for your help.

                                  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