What issues the tool detects and how to fix them.
The tool detects 12 types of Gradle 9 compatibility issues:
- 9 auto-fixable ✅ (75%)
- 3 require manual fixes ❌ (25%)
These will break your build in Gradle 9.
What it detects:
dependencies {
compile 'lib:1.0' // ❌ Removed in Gradle 9
runtime 'other:2.0' // ❌ Removed
testCompile 'test:1.0' // ❌ Removed
testRuntime 'mock:1.0' // ❌ Removed
}Fix:
dependencies {
implementation 'lib:1.0' // ✅ Use this
runtimeOnly 'other:2.0' // ✅ Use this
testImplementation 'test:1.0' // ✅ Use this
testRuntimeOnly 'mock:1.0' // ✅ Use this
}Why: Gradle 9 completely removes the old configuration names.
What it detects:
dependencies {
compile('lib:1.0') // ❌ Method removed
testCompile('test:1.0') // ❌ Method removed
}Fix:
dependencies {
implementation('lib:1.0') // ✅ Use this
testImplementation('test:1.0') // ✅ Use this
}Why: Method names changed to match configuration names.
What it detects:
# gradle-wrapper.properties
distributionUrl=...gradle-7.6-bin.zip // ❌ Too oldFix:
# gradle-wrapper.properties
distributionUrl=...gradle-9.0-bin.zip // ✅ Update to 9.0+Or run:
./gradlew wrapper --gradle-version 9.0Why: Your project needs Gradle 9+ to use new features.
These will cause runtime failures.
What it detects:
convention.getPlugin(JavaPluginConvention) // ❌ Removed
convention['java'] // ❌ RemovedFix:
extensions.getByType(JavaPluginExtension) // ✅ Use this
project.extensions.java // ✅ Use thisWhy: Convention API is removed, use Extensions instead.
What it detects:
jar {
archiveName = 'app.jar' // ❌ Deprecated
archiveBaseName = 'app' // ❌ Deprecated
archiveVersion = '1.0' // ❌ Deprecated
}Fix:
jar {
archiveFileName.set('app.jar') // ✅ Use Property API
archiveBaseName.set('app') // ✅ Use Property API
archiveVersion.set('1.0') // ✅ Use Property API
}Why: Direct property assignment is replaced by Property API.
What it detects:
task myTask << { // ❌ << operator removed
println 'Hello'
}Fix:
task myTask {
doLast { // ✅ Use doLast
println 'Hello'
}
}Why: << operator is removed for clarity.
What it detects:
task.getArchivePath() // ❌ Removed
sourceSets.main.output.getClassesDir() // ❌ RemovedFix:
task.archiveFile.get() // ✅ Use Property API
sourceSets.main.output.classesDirs // ✅ Note: pluralWhy: Old methods don't support lazy evaluation.
What it detects:
sourceSets.main.output.classesDir // ❌ classesDir removedFix:
sourceSets.main.output.classesDirs // ✅ Use classesDirs (plural)Why: Returns FileCollection instead of single directory.
What it detects:
task uploadArchives(type: Upload) { } // ❌ Upload removedFix:
// Use maven-publish or ivy-publish plugin instead
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}Why: Old publishing tasks removed, use modern plugins.
Recommended to fix.
What it detects:
archivesBaseName = 'app' // ❌ Deprecated
version = '1.0' // ❌ Direct assignment discouragedFix:
base {
archivesName.set('app') // ✅ Use base extension
}
version = '1.0' // ⚠️ Still works but consider gradle.propertiesWhy: Better organization and lazy evaluation support.
What it detects:
project.ext['myProp'] = 'value' // ⚠️ Discouraged
ext['myProp'] = 'value' // ⚠️ DiscouragedFix:
// Option 1: gradle.properties
myProp=value
// Option 2: Typed extension
interface MyExtension {
Property<String> getMyProp()
}Why: Better type safety and IDE support.
What it detects:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0' // ⚠️ Legacy
}
}Fix:
plugins {
id 'com.android.application' version '8.0.0' // ✅ Modern
}Why: plugins {} block provides better dependency management.
| Pattern | Severity | Auto-Fix | Frequency |
|---|---|---|---|
| Deprecated Configurations | Critical | ✅ | Very Common |
| Deprecated Dependency Methods | Critical | ✅ | Very Common |
| Gradle Version | Critical | ✅ | Always (if old) |
| Convention API | High | ✅ | Common |
| Archive Properties | High | ✅ | Common |
| Task Left-Shift | High | ✅ | Rare |
| API Methods | High | ✅ | Uncommon |
| SourceSet Output | High | ✅ | Uncommon |
| Properties | Medium | ✅ | Common |
| Dynamic Properties | Medium | ❌ | Uncommon |
| Deprecated Tasks | High | ❌ | Rare |
| Buildscript | Medium | ❌ | Common |
The tool may occasionally report false positives:
// compile 'lib:1.0' // ⚠️ Will be detected (but it's a comment)def msg = "Use compile" // ⚠️ Will be detected (but it's a string)Workaround: Ignore false positives or fix them anyway (they're harmless).
Fix issues in this order:
-
Critical (will break build)
- Deprecated configurations
- Deprecated methods
- Version check
-
High (will cause runtime errors)
- API changes
- Task operators
- Property APIs
-
Medium (recommended)
- Property assignments
- Build script patterns
-
Review Manual Issues
- Dynamic properties
- Deprecated task types
- Legacy patterns
After applying fixes, always test:
# Clean build
./gradlew clean build
# Run tests
./gradlew test
# Check specific tasks
./gradlew tasks --allNeed more help? See User Guide or Troubleshooting
Back to: Documentation Home