[SOLVED] QT Android on Windows XP



  • Hi.
    I need help with the development of applications for Android with QT. I installed JDK (jdk-7u25-windows-i586.exe), ADT (ADT-bundle-windows-x86-20130729.zip), NDT (android-ndk-R9-windows-x86.zip), ANT (apache-ant -1.9.2-bin) and Qt 5.1.1 for Android (Windows 32-bit, 716 MB) (qt-windows-opensource-5.1.1-android-x86-win32-offline.exe).
    In QT Creator I set in the menu Tools - Options - Android:
    Android SDK location, Android NDK location, location ANT and JDK location. I also added AVD.
    If I create a new QT GUI application and try to run the emulator, I run the emulator, but without application. Compiler output but I get:
    "14:48:49: Please wait, searching for a Suitable device for target: android-17th
    Error while building / Deploying project Test2 (kit: Android for ARM (GCC 4.6, Qt 5.1.1))
    When executing step 'Deploy to Android device'"

    If I create a new QT Quick 2 Application (Build-in types), start the emulator without application and compiler output is displayed:
    "15:09:59: Please wait, searching for a Suitable device for target: android-10 market.
    Error while building / project Deploying Test (kit: Android for x86 (GCC 4.6, Qt 5.1.1))
    When executing step 'Deploy to Android device' "

    Can anyone provide detailed instructions on how to enable Qt Android to run on the Windows XP system, in the emulator?

    THX SaX



  • Installing the Android SDK is not enough, if you want to run the emulator you have to run the "SDK manager.exe" program (in ADT folder) and install the system images for the version you selected
    (i.e. if you want to run the Android 4.2.2 ARM emulator you need "ARM Eabi v7a System image" from the "Android 4.2.2 (API17)" list of packages).

    Either that or you can connect an Android device with USB debug mode enabled (look for it in the device's "developer options").
    Remember also to select the minimal required Android version
    API 18 = Android 4.3
    ....
    API 10 = Android 2.3.3



  • Thanks L.MCH, but I have installed "ARM Eabi V7A System image".
    In the Project-for Android-arm (GCC 4.6, Qt 5.1.1)-Run-Package configuration under Android SDK target I set android-17.
    Under the deploy configurations I have set Build Qt libraries and APK.
    I do not have Android devices on which I could tested application.



  • OK. I installed and configured everything (JDK ADT, NDT, ANT and Qt 5.1.1 for Android) on a new computer (Windows 7). I made a simple Qt GUI application (one button which when clicked changes the caption). I tried the build with "Qt 5.1.1 Desktop Kit mingw 32 bit" and run and works OK on a Desktop. When I build the same application for "Android Arm (GCC 4.6, Qt 5.1.1)", I get compiled output this:

    12:01:03: Running steps for project TestQT5Android...
    12:01:03: Configuration unchanged, skipping qmake step.
    12:01:03: Starting: "C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\mingw32-make.exe"
    ...
    12:01:11: The process "C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\mingw32-make.exe" exited normally.
    12:01:11: Elapsed time: 00:08.

    and it looks like everything is OK.In My project folder, I get another folder "build-TestQT5Android-Android_for_arm_GCC_4_6_Qt_5_1_1-Debug" and in that folder I get "libTestQT5Android.so", "main.obj", "mainwindow.obj", "Makefile", "moc_mainwindow.cpp", "moc_mainwindow.obj", "ui_mainwindow.h" files. But when I run the application (in emlatorju - Android 4.2.2 - API Level 17, armeabi-V7A), I get the following warning:

    12:02:04: Please wait, searching for a suitable device for target:android-17.
    Error while building/deploying project TestQT5Android (kit: Android for arm (GCC 4.6, Qt 5.1.1))
    When executing step 'Deploy to Android device'

    Emulator runs, but applications will not start.(I can find apk file?)

    Has anyone managed to compile and run (in the emulator) program for Android on Windows PC?



  • Maybe i've found what's the issue.

    If Android SDK is properly configured and Qt Creator can't find a physical Android device or a predefined emulator setting, it pops up a dialog box to select/create an AVD (Android Virtual Device, an emulation setting composed of a name to idnetify it so you can have different simualted devices with the same andordi version, an android system image and the size of the simulated sdcard for program and data storage during emulation).
    AVDs can be configured/modified in the tools-->options-->Android menu.

    Once an AVD matching or compatible your build setting exists, it is automatically launched when you press the run (green arrow/triangle/start symbol) button.

    Problem is that it may take some time to properly start and initialize and Qt Creator may think it is not running and stops with the error message you described.

    I've tested it right now on my computer (AMD Turion II, 2.2Ghz, 4Gb ram Windows 7 64bit), after pressing run it takes a while for the emulator to start and the first "run" ends with your same error, but if I wait until the emulator starts and completes Android boot and then I press "run" again the second time it finds the emulator already running and connects to it.
    By the way, I also enabled "USB debugging" inside the emulated device settings like it has to be done on a physical Android device.
    I don't know if it's always necessary, but once it's done it is saved on the AVD internal settings and you don't have to reapeat it every time you run the same AVD again.

    IIRC the previous Necessitas 4.8.x build enviroment acted differently (it waited longer for the emulator) but that too was so slow (at least on my computer) that I preferred to test apps directly on a physical device.

    Edit:
    I forgot to add that something like that (i.e. first run non successfull because ADB startup is too slow) may happen when connecting to a physical device, but the successive runs find the ADb already running and are successfull.

    Besides that, after a successfull run (either to emulator or physical device)
    you can find the .apk in (project_folder)/android/bin
    there are lots of files there
    what you are looking for is named (projec_name)-debug.apk
    (even if it is a release build it gets the "-debug" postfix added to project name).



  • A BIG thanks L.MCH!
    The application really works if you wait until the emulator runs, and then click run button again!
    THX!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.