If you are a fan of Qt and don’t want to change to another IDE for developing Android apps then this post is for you.
Follow the steps below to have Qt for Android installed in your computer.
- Go to http://www.qt.io/download/ and download the online installer for Qt. It normally shows up as the recommended option after you answer the questions asked by Qt to set you up with the correct licensing. I usually go for the open-source choice because I’m totally fine with LGPL license in most cases
- Make sure you check Android x86, Android armv5 and Android armv7 options when you are presented with the “Select Components” page during the installation.
- Click next and continue with the installation.
- After you are finished with installing Qt, go to this link and download and install the latest JDK. (At the time of writing this JDK 8 or 1.8.0 was the latest version.)
- Then go here and download and install the stand-alone Android SDK. (Remember you don’t need Android Studio, just download the SDK.)
- Not it’s time to install the NDK. For that you need to go to this link. (Note that the NDK and SDK are just extracted to a folder in your PC and it’s not a complicated application setup in you computer so you can also use the ZIP file in both cases which is also provided.)
- One last download is The Apache Ant and you can download it from here.
- Now you need to setup Android SDK. To do that go to the folder where you installed the SDK and run “SDK Manager”. In my case it was installed in “D:/Program Files/Android/sdk”, yours should be something similar. (Update on July 2018: you need to install Android Studio to be able to properly manage installed Android SDKs):
- Usually you need all the version 4, 5 and the recent 6 Android API versions so check them all in the SDK Manager and click install.
- The last step is setting the configurations in Qt itself. So run Qt Creator and go to Tools/Options/Android and set all the folders required to the relevant components that you installed during this guide, one by one. I am sharing an screen shot of my Android options so that you can use that as a reference to enter your own settings.
Post a comment if you face any problems.
is for gradle?
If you mean using grade with these settings, I’m not sure you have to do a research on that yourself and I’d be happy if you share the results here. But, as mentioned in my answer to your first question, you can easily use a manifest XML (AndroidManifest.xml) file to configure your project.
hello
i have a problem for build and run:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project ‘android-build’.
> Failed to find Platform SDK with path: platforms;android-1
* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output.
BUILD FAILED
Total time: 8.427 secs
Warning: Android platform ‘android–1’ does not exist in SDK.
Building the android package failed!
— For more information, run this command with –verbose.
21:54:05: The process “C:\Qt\Qt5.9.0\5.9\android_armv7\bin\androiddeployqt.exe” exited with code 14.
Error while building/deploying project CalWidget (kit: Android for armeabi-v7a (GCC 4.9, Qt 5.9.0 for Android armv7))
When executing step “Build Android APK”
You are not setting target and required SDK versions correctly so it’s looking for a version of SDK that you don’t have, namely “android–1”.
Please try using a XML manifest file to set the SDK versions correctly. This is not an exact guide for what you require but it is almost a good example for How to add an XML Manifest to your Qt project.
http://amin-ahmadi.com/2015/11/29/how-to-set-icon-for-android-app-in-qt/
thanks
I did not set qt on the path:
Projects ->Build Android APK ->details ->android build sdk : set android 23
i have problem but app is run:
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Material.impl
Warning: QML import could not be resolved in any of the import paths: QtQuick.Controls.Universal.impl
I’m glad you’ve got it working.
hi, ı installed qt, Android SDK, NDK, JDK, Apache ant. When ı want to SDK’s path on Android Configurations, it happened an error. Qt is not detect SDK’s path. When ı browse sdk path, I am not finding my computer.(windows 10)
Can you share an screenshot? Send me a question using your email address and Contact Me page.