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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With