Gradle Groovy to Kotlin DSL Converter

Convert common Android Gradle Groovy syntax into Kotlin DSL.

0 characters
0 characters

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.gradle dependency declarations
  • Convert Android compileSdk, minSdk, and targetSdk values
  • Convert plugin IDs and versions
  • Convert namespace, applicationId, and versionName
  • Convert dependencies on local Gradle modules
  • Identify lines that need manual Kotlin DSL review

How to Use

  1. Paste a build.gradle Groovy snippet.
  2. Click Convert to Kotlin DSL.
  3. Review lines marked with TODO: review Kotlin DSL syntax.
  4. 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.