Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4133 pages
Flutter and app store releases

Gradle warns about space assignment in a Groovy build.gradle file

Your error

Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated. This is scheduled to be removed in Gradle 10. Use assignment ('group = <value>') instead.1 more line it can show

Fix it fast

Most common cause, 1 of 3

Your own build.gradle uses space assignment

Add an equals sign.

Fix
plugins { id 'java' }
group = 'com.example'
version = '1.0'
java {
    sourceCompatibility = JavaVersion.VERSION_17
}
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Gradle 8.12 deprecated the Groovy shorthand that sets a property without an equals sign, such as group 'com.example' or namespace "app.id". It still works, but Gradle 10 removes it. Run the build with --warning-mode all --stacktrace to get the file and line, then write propertyName = value there. Warnings from a library's build.gradle are fixed by updating that library.

  • Applies to Gradle 9.3.1, JDK 21 (Android Studio JBR)
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Show every deprecation with a stack trace. The trace contains build.gradle:<line> for each warning, which tells you whether the line is yours or a dependency's.

Run this first
./gradlew help --warning-mode all --stacktrace 2>&1 | grep -E "build.gradle:[0-9]+"

Then find the line you see in this list and open its fix:

  1. 1Your own build.gradle uses space assignmentThe stack trace points at a build.gradle inside your project, for example build.gradle:2
  2. 2Many files need the same changeDozens of modules repeat the same property names
  3. 3The line belongs to a dependency's build scriptThe path in the trace is under node_modules, the Flutter pub cache or another plugin folder

What does the error look like?

  • Properties should be assigned using the 'propName = value' syntax. Setting a property via the Gradle-generated 'propName value' or 'propName(value)' syntax in Groovy DSL has been deprecated. This is scheduled to be removed in Gradle 10. Use assignment ('group = <value>') instead.
  • Deprecated Gradle features were used in this build, making it incompatible with Gradle 10.

Cause 1 of 3

Your own build.gradle uses space assignment

You seeThe stack trace points at a build.gradle inside your project, for example build.gradle:2

Check

Gradle's upgrade guide lists five ways Groovy scripts set a property and says the last one, propertyName value, is a Gradle extension, not Groovy. Lines such as group 'x', version '1.0', namespace 'id' or sourceCompatibility JavaVersion.VERSION_17 use it.

Check
grep -nE "^\s*(group|version|namespace|compileSdk|minSdk|targetSdk|sourceCompatibility|targetCompatibility) [^=]" build.gradle */build.gradle

Fix

Add an equals sign. Method calls that take several arguments keep parentheses instead, for example jvmArgs("a", "b").

Fix
plugins { id 'java' }
group = 'com.example'
version = '1.0'
java {
    sourceCompatibility = JavaVersion.VERSION_17
}

Verify

Run with --warning-mode fail; the build passes, so no deprecation is left in the scripts it evaluated.

Verify
./gradlew help --warning-mode fail

Confirmed by docs.gradle.org

Did this fix it?

Cause 2 of 3

Many files need the same change

You seeDozens of modules repeat the same property names

Check

The upgrade guide gives a find and sed command for bulk edits. It takes the property names you list and inserts the equals sign after them.

Check
find . -name 'build.gradle' -not -path '*/node_modules/*' | wc -l

Fix

Run the documented command with the property names you saw in the warnings, then review the diff before committing. It keeps a .bak copy of each file.

Fix
find . -name 'build.gradle' -type f -exec sed -i.bak -E \
  's/([^A-Za-z]|^)(group|version|namespace)[ \t]*([^= \t{])/\1\2 = \3/g' {} +
git diff --stat

Verify

The warning count drops to zero and the build output is unchanged.

Verify
./gradlew build --warning-mode all 2>&1 | grep -c "propName = value"

Confirmed by docs.gradle.org

Did this fix it?

Cause 3 of 3

The line belongs to a dependency's build script

You seeThe path in the trace is under node_modules, the Flutter pub cache or another plugin folder

Check

React Native, Expo and Flutter apps compile their native plugins with those plugins' own build.gradle files. Edits there are overwritten on the next install.

Check
./gradlew help --warning-mode all --stacktrace 2>&1 | grep -E 'node_modules|pub-cache' | sort -u

Fix

Update the plugin to a release that uses assignment syntax. If none exists yet, leave it: it is a warning until Gradle 10, so you can still build on Gradle 8.12 to 9.x while the maintainer catches up.

Fix
npm outdated
# or, in Flutter
flutter pub outdated

Verify

After the update the trace no longer lists that plugin's file.

Verify
./gradlew help --warning-mode all --stacktrace 2>&1 | grep -cE 'node_modules|pub-cache'

Confirmed by docs.gradle.org

Did this fix it?

How do I stop it coming back?

  • Run CI with --warning-mode fail on your own modules so new space assignments are caught in review.
  • Write new Groovy scripts with = everywhere, or use the Kotlin DSL, which only allows assignment.
  • Read the Gradle upgrade guide before each major Gradle update.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.