0

I downloaded Qt Creator 3.3.0 Based on Qt 5.4.0 on Windows. Also jdk1.8.0_25, SDK (all updated), NDK-r10d, apache-ant-1.9.4. Set all necessary configurations. But when I try to build project I get an error:

Error: Target id 'android--1' is not valid.

As far as I understand it is about the API level. But where can I set it?

Nejat
  • 31,784
  • 12
  • 106
  • 138
Viacheslav
  • 21
  • 4
  • Downvoted. Provide a more in-depth explanation and the exact error. Did you just built it or tried to run? Improve the question with all the necessary info. – BaCaRoZzo Feb 10 '15 at 01:26
  • The building stops at 4 from 5. I don't think the problem in deployment, because before that I tried **Android Studio** and everything works. – Viacheslav Feb 10 '15 at 05:22
  • Now I should return to this question. Although, the decision have been found and it is still the same, you should reinstall JDK, it is not an answer on the question. I have tried to create different projects just to study Qt, but today when I created another one I have got the same result as I had a week ago. But today I already have working projects and I found the difference. Qt project has an auto generated file: PROJECT_NAME.pro.user and there you can find the strings 'android--1', so you should change all of them to 'android-21' (depends on your SDK version) and the project will be fixed. – Viacheslav Feb 17 '15 at 18:56

3 Answers3

1

Since Qt 5.4 along with QtCreator 3.3.0 you should go to Projects > Build Android APK > Details for configuring deployment settings. Select an Android API version for Android Build SDK option. Also 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, ...

Nejat
  • 31,784
  • 12
  • 106
  • 138
  • 1
    Yes, I thought about **Android Build SDK** option, but there is no items in that combobox. Does it mean that I shoud install something in SDK? – Viacheslav Feb 10 '15 at 05:08
  • Have you installed Android SDK Platform-tools and Android SDK Build-tools when updating SDK? – Nejat Feb 10 '15 at 05:11
0

I reinstalled JDK and now everything works. I don't know definitely, but I think the problem had been obtained after update JDK from 1.8.0_25 to 1.8.0_31. The folder with previous version for some reason still was there. It was like:

..\Java\jdk1.8.0_25

..\Java\jdk1.8.0_31

And Qt refered to the jdk1.8.0_25 which already was obsolete.

Community
  • 1
  • 1
Viacheslav
  • 21
  • 4
0

What helped me - switch off antivirus. Why? See below:

I've got the same error and re-installation didn't help.

Running manually android.bat list targets from cmd gives the 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.

OhBeWise
  • 5,350
  • 3
  • 32
  • 60