6

I am trying to build an android APK in Qt Creator 3.0.1 . I have properly given the configured Android SDK, NDK, Ant, Java Jdk. In Build Android APK step under Build there is a option to specify Android Build SDK i.e target SDK. I am currenty using API 21 but it i am not getting an option to specify it over there.

Plz Help how can i do that.

Nejat
  • 31,784
  • 12
  • 106
  • 138
Eljay
  • 941
  • 5
  • 15
  • 30

2 Answers2

4

First you should select Tools > Options > Android to add paths to the Android NDK and SDK :

enter image description here

Also select the Automatically create kits for Android tool chains option.

For configuring deployment settings you should go to Projects > Build Android APK > Details Since Qt 5.4 along with QtCreator 3.3.0. To create an APK package, select the Bundle Qt libraries in APK option :

enter image description here

You can also select Create Templates to create the manifest file to set application settings like icon, name, ...

In previous versions of Qt and Qt Creator you should go to Projects->Run->Deploy.

I recommend you to use the latest version of Qt and Qt Creator for Android development and deployment.

Nejat
  • 31,784
  • 12
  • 106
  • 138
  • Android Build Sdk: is not showing any API. I have installed Android Api 21 – Eljay Feb 03 '15 at 05:53
  • I strongly recommend to use the latest Qt and Qt Creator. Many bugs have been fixed and many new features are added in the latest version. Try it and see if you still have the problem. – Nejat Feb 03 '15 at 05:55
  • I am using Qt creator 3.3.0 and Qt 5.4.0 for android these are the latest versions – Eljay Feb 03 '15 at 05:58
  • You should select `Tools > Options > Android` in Qt Creator to add the Android NDK and SDK paths. Have you set them properly? – Nejat Feb 03 '15 at 06:03
  • Yes all the paths have been set properly.I am using Qt for Mac OS – Eljay Feb 03 '15 at 06:07
  • Do you install Android SDK Platform-tools and Android SDK Build-tools when updating SDK? – Nejat Feb 03 '15 at 18:25
  • yes i have installed Android sdk platform and android sdk build tools and API versions: 21,20,18,16,11,10 – Eljay Feb 04 '15 at 04:12
  • I have tested it with API 21 and everything was OK. – Nejat Feb 04 '15 at 04:20
  • my only problem is that in Android Build SDK where U have mentioned android-18 nothing is coming over there while all paths have been correctly set – Eljay Feb 04 '15 at 05:23
  • What should i do next – Eljay Feb 04 '15 at 05:44
  • As you said you have done everything that i can think of. I can't guess anything else. – Nejat Feb 04 '15 at 06:20
  • is there any need for installing some android plugin for qt creator – Eljay Feb 04 '15 at 07:50
  • No there is not such a thing. Qt Creator is enough. – Nejat Feb 04 '15 at 07:54
  • can u tell me that how can i create object of java class in C++ class in QT – Eljay Feb 06 '15 at 11:02
  • You should use JNI. See this : http://stackoverflow.com/questions/27760599/executing-java-file-in-qt – Nejat Feb 06 '15 at 12:59
  • Hi Found this Interesting question Can you please answer this: https://stackoverflow.com/questions/46969175/how-to-reuse-same-widgets-in-different-qt-forms – Eljay Oct 27 '17 at 07:53
3

What helped me - switch off antivirus. Why see below:

I've got the same error and reinstallation didn`t help.

Runnning manually 'android.bat list targets' from cmd gives proper list of targets.

After digging into QtCreator code I found the reason - magic code for get list of targets in qt:

void AndroidConfig::updateAvailableSdkPlatforms() const
{
    QProcess proc;
    proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
    proc.start(androidToolPath().toString(), QStringList() <<     QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
    if (!proc.waitForFinished(10000)) {
        proc.terminate();
        return;
    }

As you can see if 'android.bat list target' cmd will not finish for 10 seconds qtcreator will just terminate the process.

In my case it was 15 secs befor it finishes due to antivirus checks - so switching off antivirus could help in your case.

No need to restart QtCreator just open Android section in options again and all targets should be loaded.

I 'love' Qt - it is always like this with it.