Gradle Groovy to Kotlin DSL Converter
Convert common Android Gradle Groovy syntax into Kotlin DSL.
About This Tool
This Gradle Groovy to Kotlin DSL converter helps migrate common Android build.gradle snippets to build.gradle.kts syntax.
It handles common dependency declarations, plugin declarations, apply plugin, Android SDK properties, namespaces, string assignments, and project dependencies. Unsupported non-empty lines are preserved with a review marker so they are not silently changed.
Benefits and Use Cases
- Convert common
build.gradledependency declarations - Convert Android
compileSdk,minSdk, andtargetSdkvalues - Convert plugin IDs and versions
- Convert
namespace,applicationId, andversionName - Convert dependencies on local Gradle modules
- Identify lines that need manual Kotlin DSL review
How to Use
- Paste a
build.gradleGroovy snippet. - Click Convert to Kotlin DSL.
- Review lines marked with
TODO: review Kotlin DSL syntax. - Copy the generated code into
build.gradle.kts.
Android Example
Groovy input:
android {
namespace 'com.example.app'
compileSdk 35
}
dependencies {
implementation 'androidx.core:core-ktx:1.15.0'
}Generated Kotlin DSL:
android {
namespace = "com.example.app"
compileSdk = 35
}
dependencies {
implementation("androidx.core:core-ktx:1.15.0")
}Frequently Asked Questions
Does this convert every Groovy Gradle feature?
No. It focuses on common Android build-script syntax and marks unsupported lines for manual review instead of guessing.
Which dependency declarations are supported?
The converter supports common configurations including implementation, api, compileOnly, runtimeOnly, testImplementation, androidTestImplementation, debugImplementation, kapt, and ksp.
Does it change my Gradle files?
No. Conversion happens locally in your browser and the tool only generates text for you to review and copy.
Should I review the generated Kotlin DSL?
Yes. Gradle plugins can expose custom Groovy methods or dynamic properties that require project-specific Kotlin DSL changes.