I want to migrate build.gradle file from Groovy to Kotlin, since I updated my android studio to Bumblebee, I'm not sure how to do it.
This is how build.gradle looks when I create a new project.
I'm not sure on how to migrate plugins{} part.
buildscript {
ext {
compose_version = '1.0.1'
}
}
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
id 'org.jetbrains.kotlin.jvm' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I got the answer in the documentation here https://developer.android.com/studio/build#kts .
Here's how it's written in Kotlin.
plugins {
id("com.android.application") version "7.1.0-beta02" apply false
id("com.android.library") version "7.1.0-beta02" apply false
id("org.jetbrains.kotlin.android") version "1.5.30" apply false
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
The following steps worked for me.
Step-1 : Create the plugins
tag and give it the id
values. delete the buildscript
tag.
Step-2 : Open the pluginManagement
tag in the settings.gradle
file and make some tags and values.
Step-3 : In the last step, update the values defined at the top in the build.gradle
file as id
.
Optional : Since it is in the build.gradle
file, it must be deleted.
repositories {
mavenCentral()
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.