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. Create shared iOS & Android Library
Forum Update on Monday, May 27th 2025

Create shared iOS & Android Library

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 3 Posters 1.6k 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.
  • T Offline
    T Offline
    tobinharris
    wrote on 23 Sept 2013, 15:17 last edited by
    #1

    Would QT allow me to write a library that could be shared across iOS and Android?

    This library would contain some core app services including

    • Gateway API calls to remote servers
    • Models (entities)
    • Persistence of those models in Sqlite, along with helper methods or data access
    • Business logic
    • Separate test suite

    I'd then want to link those into Android and iOS native apps to achieve a level of code reuse between the two.

    Tobin

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 23 Sept 2013, 19:53 last edited by
      #2

      Hi and welcome to devnet,

      Shared as in using the same code ? Yes, you can easily isolate the platform specific API that you might want to use using Qt's platform ifdefs.

      You will need however to build your lib for both platform separately (as Qt is built for each platform it supports)

      Hope it helps

      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
      • T Offline
        T Offline
        tobinharris
        wrote on 25 Sept 2013, 16:34 last edited by
        #3

        Thanks for the reply.

        Is there any particular thing I need to look at if I wanted to learn to write the code once then compile and link the library for Android and iOS separately. Is there any special project type or tools? I'm a C++ noob :)

        Tobin

        1 Reply Last reply
        0
        • R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 26 Sept 2013, 06:12 last edited by
          #4

          no not really. It's more a matter of code design than compiler settings, etc.
          You can look at Qt implementations for some classes as a reference. Especially classes with system specific stuff.

          --- 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

          1 Reply Last reply
          0

          1/4

          23 Sept 2013, 15:17

          • Login

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