Travis Griggs
09/19/2022, 4:01 PMplugins {
id 'org.jetbrains.kotlin.jvm' version '1.7.10'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.7.10'
}
There's two build.gradle files. Which one? I've tried placing it in both of them at various locations, and I always get errors about it needing to above or before one thing or another. Is the snippet/instructions up to date?Patrick Geselbracht
09/19/2022, 4:04 PMbuild.gradle
should workJorge Cordero Camarena
09/19/2022, 4:04 PMJorge Cordero Camarena
09/19/2022, 4:05 PMTravis Griggs
09/19/2022, 4:06 PMephemient
09/19/2022, 4:06 PMephemient
09/19/2022, 4:06 PMephemient
09/19/2022, 4:08 PMplugins { id("org.jetbrains.kotlin.android" }
or plugins { kotlin("android") }
near the top of your build script, just add id("org.jetbrains.kotlin.plugin.serialization")
or kotlin("plugin.serialization")
there as wellephemient
09/19/2022, 4:09 PMbuildscript
if it exists, but before anything else (except comments and imports)Travis Griggs
09/19/2022, 4:44 PMapply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
I tried to recast this entry as something like:
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
But it didn't go for that.
I did find that if I removed the first line, then it workedCasey Brooks
09/19/2022, 6:55 PMsettings.gradle
sits in the root of your repo and tells Gradle some basic info for configuring the entire project as a whole. Most notably, what subprojects you have (the include(":app")
lines in it)
• For every subproject listed in settings.gradle
, a folder at the corresponding path (replace :
with /
) should have a build.gradle
file. This file configures that specific subproject, and is typically where you’d add your plugins { }
block or apply plugin: ""
lines
• Additionally, you’ll probably have one more build.gradle
file at the root of the repo. While this is a subproject just like the others, you might also see some stuff here that applies plugins or makes other configurations to all other subprojects. Generally, this is not the place to add plugins such as id 'org.jetbrains.kotlin.jvm'
or id 'org.jetbrains.kotlin.plugin.serialization'