Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Can I build for Android on Ubuntu(Linux) and use the same project to deploy for iOS using a Mac?
theBCWIntern last edited by
My employer has tasked me with building a Cross-Platform application. The workstation runs Ubuntu. I realize I will need Mac OS X and Xcode to build iOS applications with QT.
So, My question here is -
Can I develop an application(QT Quick control application) for Android on my linux. Then, take the files to a Mac, (install QT, Xcode and get iOS dev account etc.) and open the project to then deploy it on an iOS device?
In other words, Does the code remain the same? Can I develop on Linux and then use a Mac to deploy it to iOS?
Hi and welcome to devnet,
Yes, that's one of the goal of Qt: write once, compile everywhere. Note that you can as well do all the development on the Mac machine. Android development is supported on all three desktop OS.
theBCWIntern last edited by
@SGaist Yes, I do know that I can develop for Android on any OS. But the Mac machine at office is in use and cannot be given for daily use to me. So, I can use it only to deploy it to iOS when needed.
So I'm guessing that's good enough. I can write in Linux, then copy the files to Mac and then just deploy it to iOS without any changes. Right?
You should rather use something like Git to properly handle your sources. That will make it also easier to transfer between the OS as well as avoid problems with line ending handling.
Gourmet last edited by
Be careful. Not all OS features can be used from Qt. My Qt apps have about 500 lines of Java code and bunch of callObjectMethod() calls from C++ code. All this cannot work on iOS. It is necessary to build working application for Android. Of course it depends from Qt version you use and from application features you need. But I do not think it is possible create powerful app only on Qt without using platform calls.
timday last edited by
@theBCWIntern Yes, I do pretty much what you propose... develop simple QtQuick (QML & C++) applications on mainly my Linux desktop. I also build for and deploy to Android from there. For OSX and iOS I build on a Mac (xcode needed to deploy to iOS and the appstore). My QML and C++ sources are pretty much the same for all platforms apart from a very few #ifdef guarded sections of C++ where platform-specific quirks creep in. (I also occasionally build for Windows on a Windows VM). However... I don't use Creator; I prefer to use build scripts... too many platform differences around deployment/packaging/metadata and I like to be in control of what's going on. Also, my apps are simple self-contained "ebook" type things and don't interact much with the platform... the more you want to integrate with platform features which can't be accessed by a uniform Qt API the more likely it is you'll have to write platform-specific code (like @Gourmet describes above).
Uncle_Masta last edited by
You've got it right. In the simplest case, no code changes and a simple .pro file. But, if you're linking in libraries, doing network calls over ssl, or doing anything that requires native code, it can get tricky.
- compiler directive differences: clang vs g++
- android gradle files
- mac tools for frameworks
It's all doable, but it took some work to figure out.