Configuring Qt Gradle Plugin
The plugin needs to know where certain parts of the Qt toolchain are. The project properties can be configured similar to Gradle project properties, Gradle properties files or Gradle build files basics starting from Qt Gradle Plugin 1.4 onward and in following priority preference.
Use whichever method you prefer, but keep the deprecation notes in mind. For example, if you come from native Android development, you may find the Gradle project properties most familiar.
- Configuring as terminal parameters
- Configuring in gradle.properties
- Configuring as environment variables
- Configuring in local.properties
- Configuring in build.gradle(.kts) [deprecated]
For configuring with gradle.properties, see Gradle project properties. For example in the <yourappname>/gradle.properties file, you need to define paths for the plugin.
For configuring with local.properties, use the same syntax as in gradle.properties, but just in the local.properties. See limitations from Gradle properties files.
Note: In previous versions, you could also configure the Gradle plugin in the build.gradle(.kts) file inside a QtBuild block. See more from Gradle build files basics, however, this approach is deprecated from Qt Gradle Plugin version 1.3 onward and its support will be removed in a future version.
Plugins path
Inside the plugins block, include the plugin ID and version.
plugins {
id("org.qtproject.qt.gradleplugin") version("1.+")
}plugins {
id 'org.qtproject.qt.gradleplugin' version '1.+'
}Dependency chain
The plugin automatically adds itself as a dependency to the default assembleDebug and assembleRelease tasks. However, when using custom product flavors, the plugin cannot know the names of the flavors, so you'll need to add them manually. For example, for a flavor named "core", add the dependency manually as shown.
android {
...
applicationVariants.all {
if (name == "coreDebug") {
preBuildProvider.dependsOn("QtBuildTask")
}
}
...
}android {
...
applicationVariants.configureEach {
if (name == "coreDebug") {
preBuildProvider.get().dependsOn "QtBuildTask"
}
}
...
}Define the properties as shown.
QtPath
Qt path for version 6.8.0 or newer where the Qt version you want to build against is installed:
qtPath=/home/username/Qt/or
qt.path=/home/username/Qt/// Deprecated. Use gradle.properties instead
QtBuild {
...
qtPath = file("/home/username/Qt/6.8.0")
...
}// Deprecated. Use gradle.properties instead
QtBuild {
...
qtPath file('/home/username/Qt/6.8.0')
...
}QML project directory
Add the path to the QML project directory:
qtProjectPath=../qmlappor
qt.projectPath=../qmlapp// Deprecated. Use gradle.properties instead
QtBuild {
...
projectPath = file("../qmlapp")
...
}// Deprecated. Use gradle.properties instead
QtBuild {
...
projectPath = file('../qmlapp')
...
}Other properties are optional and explained below:
Optional: Qt ABI directory
Note: This field is deprecated and will be removed in a future version. Use the extraCMakeArguments property to define the QT_ANDROID_ABIS flag or the QT_ANDROID_BUILD_ALL_ABIS flag. Alternatively, you can define the ABIs using ndk.abiFilters property in build.gradle(.kts) file.
By default, this is not defined, and Multi-ABIs will be built. If this path is defined, then a build will be done for that kit ABI only.
qtAbiPath=/home/username/qt/build/your-qt-kitor
qt.abiPath=/home/username/qt/build/your-qt-kit// Deprecated. Use gradle.properties instead
QtBuild {
...
qtKitDir = file("/home/username/qt/build/your-qt-kit")
...
}// Deprecated. Use gradle.properties instead
QtBuild {
...
qtKitDir = file('/home/username/qt/build/your-qt-kit')
...
}Optional: Extra CMake arguments
For example:
qtExtraCMakeArguments=-DCMAKE_BUILD_TYPE=Release,-DANDROID_NDK_ROOT=/opt/android/ndk/26.1.10909125or
qt.extraCMakeArguments=-DCMAKE_BUILD_TYPE=Release,-DANDROID_NDK_ROOT=/opt/android/ndk/26.1.10909125// Deprecated. Use gradle.properties instead
QtBuild {
...
setExtraCMakeArguments("-DCMAKE_BUILD_TYPE=Release", "-DANDROID_NDK_ROOT=/opt/android/ndk/26.1.10909125")
...
}// Deprecated. Use gradle.properties instead
QtBuild {
...
extraCMakeArguments = ['-DCMAKE_BUILD_TYPE=Release', '-DANDROID_NDK_ROOT=/opt/android/ndk/26.1.10909125']
...
}Optional: ninjaPath
If you haven't installed Ninja from the Qt Maintenance Tool and its location is not defined in your system path, you can provide the path as follows:
qtNinjaPath=C:\Qt\Tools\Ninjaor
qt.ninjaPath=C:\Qt\Tools\Ninja// Deprecated. Use gradle.properties instead
QtBuild {
...
ninjaPath = "C:\Qt\Tools\Ninja"
...
}// Deprecated. Use gradle.properties instead
QtBuild {
...
ninjaPath = 'C:\Qt\Tools\Ninja'
...
}© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.