How to build an app for an android phone.
-
First of all I must apologize for asking a very basic question. I thought that I would try and use Qt to create a very simple application which will run on an android phone. So I downloaded
Qt 5.1.1 for Android (Linux 32-bit, 461 MB)
and installed it.
I then added a very simple project which I built and ran on the linux desktop.
Thats when I got stuck. I have downloaded the
adt-bundle-linux-x86, but I think that this is only needed when I connect to a phone
I've looked at the build settings using Creator in the hope that I might see something referring to android, but cant see anything. To start with I would like to be able to run my simple app in an emulator.
I just dont know how to proceed, I will keep looking, but can anyone point me to an example or at least some documentation as to how I can run the emulator?
Again I must apologize for this very basic question.
Thanks for your help -
First you have to install the JDK (Java SDK), ADT bundle (or just the Android SDK), the Android NDK and Ant.
Then using the SDK manager you have to install/upgrade the specific SDK files for the Android versions you want to build for or test and the associated Sytem Images (required if you want to tun them in the emulator).
In the Android SDk there is a lot of optional stuff, you don't have to install everything, just the "Platform SDK" for the Android API that's your minimal required version (and successive versions if you want to test it on those too), the documentation and tools and the system images you want to run on the emulator.Then look into Qt Creator Tool-->Options-->Android to tell QT Creator where the required tools (Java JDK , Android SDK, Android NDK, Ant) so the GCC crosscompilers for Android will be detected.
Then look into Tools-->Options-->Build&Run to manually configure "Qt Versions" and "Kits"(Qt versions + toolchain to build your app).
After that you can add Android kits to your app, etc. etc.You may also find these threads quite useful:
"http://qt-project.org/forums/viewthread/31732/":http://qt-project.org/forums/viewthread/31732/
"http://qt-project.org/forums/viewthread/32332/":http://qt-project.org/forums/viewthread/32332/ -
You can also find more information in the Qt 5.1 and Qt Creator documentation:
http://qt-project.org/doc/qt-5.1/qtdoc/android-support.html
http://qt-project.org/doc/qtcreator-2.8/creator-android-app-tutorial.html -
Thank You so much for your help.
I already have Java SDK version 1.7.0 installed.
I have downloaded adt-bundle-linux-x86.zip and I have unzipped it into a my user area.
I have run eclipse and used it to install other required packages.
My phone is quite old so I also installed android 2.0
I downloaded android-ndk-r4-linux-x86.zip and unzipped that into my local user area.
I have done similar with apache-ant-1.9.2
I then launched Qt creator in order to give the Android SDK location.
Thats when I get stuck.What exactly should I be typing in to the "Android SDK location"?
My current path to the unzipped adt-bundle-linux-x86.zip is
"/home/philp/Qt5.1Android/adt-bundle-linux-x86-20130729"
This directory contains
eclipse and sdk. Should I type
"/home/philp/Qt5.1Android/adt-bundle-linux-x86-20130729/sdk" for the location. I've seen examples like
" /home/johnsmith/dev/android-sdk-linux". I dont have a file anywhere called android-sdk-linux. Should I have?
Thanks again for any help -
Qt Creator just needs the SDK, not the whole ADT, so if you want to use it "as unzipped" select
“/home/philp/Qt5.1Android/adt-bundle-linux-x86-20130729/sdk”The examples simply didn't use the default directory name generated while unzipping the ADT bundle but a custom one (probably to make it simpler to update the SDK by overwriting it with a new one without having to update the directory path in all the configuration files that may reference it).
-
Thank You LMCH
I have progressed further. Cant pretend to understand all that I am doing, but can now get and emulator up and running using my very simple app. I even built an apk. But not too surprisingly it did not work on my phone. I will look into it next week.Thanks Again..
-
Probably if it isn't something depending on features not supported on your phine, it's either the minimum supported API level or the run options about Qt libraries deployement (see left toolbar's "Projects"-->"(your android kit"-->"Run"-->"Deploy Configurations").
-
Thanks LMCH
My phone is a HTC Desire bravo. Android 2.2.2 Froyo which has a ARMv7nSnapdragon processor.
I am building and running with:-
Android with arm (gcc 4.4.3, Qt 5.1.1) which says Android GCC (arm 4.4.3).
When I try and run the apk on the phone I get the error message:-
"Your app has encountered a fatal error and cannot continue"Package configurations:- android-17.
Deploy configurations:- Bundle Qt libraries in APK.
Run configuration: Run on Android device.Is it because I am using arm 4.4.3 and I should be using arm 2.2?
I did I am sure select that earlier, but the option is not available under Qt, so I will recheck what I did earlier and try get the arm 2.2 kit???
thanks again -
Check this link:
"http://qt-project.org/doc/qtcreator-2.7/creator-deploying-android.html":http://qt-project.org/doc/qtcreator-2.7/creator-deploying-android.htmlThey say the minimum level supported by Qt 5.x is API level 9 (Android 2.3.3).
Maybe you can try using Qt 4.8 for Android (Necessitas).