Failed to create Android APK in Qt Creator

I am trying to create an android apk in Qt Creator 3.0.1. I gave the configured Android SDK, NDK, Ant, Java Jdk correctly. In the "Build Android APK" step in the "Build" section, there is an option to specify the Android Build SDK ie target SDK. I am currently using API 21, but I am not getting the opportunity to specify it there.

Help plz how can i do this.

+6
source share
2 answers

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

enter image description here

Also select the Automatically create toolboxes for tool chain option.

To configure the deployment settings, you must go to Projects> Create Android APK> Details . Since Qt 5.4 along with QtCreator 3.3.0. To create an APK package, select the Bundle Qt Library in the APK :

enter image description here

You can also select Create Templates to create a manifest file for setting application parameters such as icon, name, ...

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

I recommend that you use the latest version of Qt and Qt Creator to develop and deploy Android.

+4
source

What helped me was to disable the antivirus. Why below:

I have the same error and reinstallation did not help.

Starting manually the "android.bat list targets" from cmd gives the correct list of targets.

After digging into the QtCreator code, I found the reason - the magic code to get the list of goals 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 the "Android target for android.bat" cmd will not end in 10 seconds, qtcreator will just end the process.

In my case, it was 15 seconds before it ended due to antivirus scans - therefore disabling antivirus can help in your case.

No need to restart QtCreator, just open the Android section in the settings and all goals should be loaded.

I love Qt, it’s always like that.

+3
source

Source: https://habr.com/ru/post/981902/


All Articles