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. Load Spatialite plugin in Android
Forum Updated to NodeBB v4.3 + New Features

Load Spatialite plugin in Android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 2 Posters 1.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.
  • FerniF Offline
    FerniF Offline
    Ferni
    wrote on last edited by
    #1

    Hi everyone!
    I've made an application for Android and I need to use sqlite and spatialite. I built sqlite from sources and I set the following variables:

    DEFINES += \
        REENTRANT=1 \
        SQLITE_THREADSAFE=1 \
        SQLITE_ENABLE_FTS3 \
        SQLITE_ENABLE_RTREE \
        SQLITE_ENABLE_LOAD_EXTENSION \
    

    From this page I took spatialite library but I think that spatialite module is already integrated with sqlite so I'd need to use only libjsqlite, is this right?

    On the other hand, when I try to use any of these libraries I get a message about some drivers that are not loaded. First a message that cannot load spatialite extension and then the error about the driver

    Cannot load spatialite extension:  QSqlError("", "Unable to fetch row", "No query")
    
    QSqlError("", "Driver not loaded", "Driver not loaded")
    

    Reading about this error I found that I need to compile Qt from sources and change some lines to allow loading plugins because it's turn off by default. Is there an easier way to get this? Currently, I'm using the precompiled version of Qt.

    Can someone guide me a little bit in this matter?

    Thansk!
    Fernando

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

      Hi,

      Something is not clear. Are you trying to build a custom SQLite Qt plugin or do you want to use your custom SQLite library directly in your application ?

      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
      • FerniF Offline
        FerniF Offline
        Ferni
        wrote on last edited by
        #3

        Hi @SGaist ! Thanks for your reply. I need to use spatialite (sqlite plugin) in my project. The problem that I found was that Qt doesn't allow to load sqlite plugins by default. Maybe I misunderstand something. I think that I need to build a custom SQLite Qt plugin but I also need to compile SQLite library with those flags that I wrote, isn't it?
        I'm not seeing what is the module that is blocking the loading from Spatialite.

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

          Your logic sounds good:

          1. Custom SQLite build
          2. Re-build the qsqlite plugin with that custom SQLite library
          3. Replace the installed plugin with this one.
          4. Deploy your custom SQLite library with it's plugin alongside

          You should start your application with the QT_DEBUG_PLUGINS environment variable set to 1. This will give you more information about why it doesn't load.

          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
          • FerniF Offline
            FerniF Offline
            Ferni
            wrote on last edited by
            #5

            Thank you @SGaist !!! I will try it and tell if everything went well!!

            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