Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying android applications Qt 5.1

I have been trying to deploy a simple Qt application to android but with no luck. Details are as follows

  1. Qt Version : Qt 5.1.0 for Android (Windows 32-bit) downloaded from here

  2. Qt Creator version : Qt Creator 2.7.2

I have set the following options in Qt Creator

Android configurations

  1. Android SDK location : C:\adt-bundle-windows-x86-20130717\adt-bundle-windows-x86-20130717\sdk

  2. Android NDK location : C:\android-ndk-r8e

  3. Ant location : C:\Program Files\Java\jdk1.7.0_25

  4. AVD name : AndroidAVD (API Level 17,armeabi-v7a)

Kit Configuration

  1. Name of the kit : Android for arm(GCC 4.4.3,Qt 5.1.0)(default)

  2. Device type : Android

  3. Device : Run on Android

  4. Sysroot : Its empty

  5. Compiler : GCC (arm 4.4.3 )

  6. Android GDB Server : C:\android-ndk-r8e\prebuilt\android-arm\gdbserver

  7. Debugger : C:\android-ndk-r8e\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin\arm-linux-androideabi-gdb.exe

  8. Qt Version : 5.1.0 (android_armv7)(C:\Qt\Qt5.1.0\5.1.0\android_armv7\bin\qmake.exe)

  9. Deploy configuration of the Kit(for both Release and Debug) : Deploy local Qt libraries and Use Local Qt libraries option is checked

  10. OS : Windows 7 64 bit

The Problem

When I try to build,everything builds fine. I get libTheTestApp.so in my build directory. Also the project directory now contains a folder named "android" containing the manifest file and some other files.

When I try to Run the app, the emulator starts but I can't find my app. If I close my emulator and return to Qt Creator I get the following error

Please wait, searching for a suitable device for target:android-17.
Error while building/deploying project TheTestApp (kit: Android for arm (GCC 4.4.3, Qt 5.1.0)) When executing step 'Deploy to Android device'

If I do "adb devices" while the emulator is running, I get the id of the running emulator

Also I tried searching the internet before posting this question here. I found this link.

My question is how do I deploy a Qt5 application to an android device? Are there any links which say how to do it? I am asking this because I have followed the instructions provided in Qt5ForAndroidBuilding link while building the app.

Thanks for your time.

like image 441
Programmer Avatar asked Jul 23 '13 18:07

Programmer


3 Answers

I was successfully able to deploy a simple QT application to my android device. From what I understand ,Qt creator first tries to deploy the app to a device if it finds one. If no device is found, it tries to launch an AVD and deploys the application to the emulator.

"Please wait, searching for a suitable device for target:android-17." Try targeting a lower api level by changing it in Projects->Selected Toolkit -> Run -> Package Configuartion -> Manifest

And also , make sure that the Ant location points to InstallLocation\ant\bin\ant.bat

like image 101
user2423772 Avatar answered Oct 08 '22 14:10

user2423772


Video Build and deploy Qt apps to Android using Qt 5.1 on Windows http://www.youtube.com/watch?v=_nkhlhBwkjk.

like image 44
Vasily Kolesnikov Avatar answered Oct 08 '22 15:10

Vasily Kolesnikov


  • You did not mention that whether you specified jdk location in Qt Creator or not.
  • for ant location, please specify the path to bin/ant.bat file from ant directory.

For people who will see this post in the future:

Do not launch avd from Qt Creator, first run the avd from android sdk manager

  • do not create your own avd, use the existing ones instead, as follows
  • go to android sdk folder, open android SDK Manager > tools > Manage AVDs...
  • there are two tabs at the top, go to "Device Definition" tab
  • select any one avd and click on "Create AVD"
  • from new window that comes up, select target api level, cpu/abi and check snapshot checkBox at the bottom of the window and press "ok" button.
  • new window comes up with the specifications of created avd, click ok now you have a valid avd. Select it and press "start" button. wait until the avd is lauched, unlock it and run you project.
like image 33
qurban Avatar answered Oct 08 '22 14:10

qurban