Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt compiler reports invalid build tools version for Android

Tags:

android

qt

I have been developing Android applications using Eclipse/Android Studio. Now, I am exploring building an application using QT. I installed QT and configured it for Android as explained at http://qt-project.org/wiki/Qt5ForAndroidBuilding. I later my first Android app using "QT Quick Application" template. When I compile it from QT Creator, I get the following error:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\MyQtApps\build-MyTest1-Android_for_armeabi_v7a_GCC_4_8_Qt_5_4_1-Debug\android-build\build.gradle' line: 39

* What went wrong:
A problem occurred evaluating root project 'android-build'.
> Invalid revision: build-tools-21.1.2

Android build tools version 21.1.2 is present on the machine. In fact, my SDK and all other Android tools are completely up to date.

Next, from the options dialog, I turned "Use Gradle" off and entered the path for Ant executable. After that, I proceeded to create a new project. This project builds and deploys fine on my mobile device.

Looks like the problem is with Gradle integration. For now, I can simply go with Ant but would be nice to have it fixed. Any suggestions? Regards.

like image 539
Peter Avatar asked Mar 18 '15 09:03

Peter


1 Answers

For those who are running into this problem (and I assume this includes everyone who is using Qt for Android development), the solution is to fix Qt-generated gradle.properties file. This file contains the following line:

 androidBuildToolsVersion=build-tools-21.1.2

File build.gradle tries to use this variable as:

android {
   ...
   buildToolsVersion androidBuildToolsVersion
   ...
}

Function buildToolsVersion expects a value such as 21.1.2 and not build-tools-21.1.2. So the fix is to edit gradle.properties file as:

 androidBuildToolsVersion=21.1.2

I still don't know where Qt Creator picks up 21.1.2 from. In my case, I used the following setting:

 androidBuildToolsVersion=23.0.0

Now, things work as expected.

like image 130
Peter Avatar answered Oct 17 '22 23:10

Peter