I am attempting to import a ksp dependency, but when I do
ksp()
it shows up as an unresolved reference. In an attempt to add ksp to my project, I followed the quickstart guide here https://kotlinlang.org/docs/ksp-quickstart.html but when I sync gradle I get a significant amount of errors. Am I doing something wrong?
Zach
09/16/2022, 7:11 PM
Main error:
Copy code
org.gradle.internal.exceptions.LocationAwareException: Build file '/Users/zach.calman/Projects/step-out-android/build.gradle.kts' line: 2
Plugin [id: 'com.android.application', version: '7.2.2', apply: false] was not found in any of the following sources:
t
tapchicoma
09/16/2022, 7:34 PM
android plugins are loaded from Google maven repo:
google()
in Gradle
z
Zach
09/16/2022, 7:38 PM
I am loading my plugins with the google() maven repo
Zach
09/16/2022, 7:39 PM
I followed the playground example, here is what my settings.gradle looks like (mostly)
Copy code
pluginManagement {
val kspVersion: String by settings
val kotlinVersion: String by settings
plugins {
id("org.jetbrains.kotlin.android") version kotlinVersion apply false
id("com.google.devtools.ksp") version kspVersion
kotlin("jvm") version kotlinVersion
}
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
Zach
09/16/2022, 7:39 PM
I am still unable to use add
kotlin("jvm")
to any modules or use
ksp()
dependencies
Zach
09/16/2022, 7:49 PM
Okay, I was able to resolve it by adding the plugin
com.google.devtools.ksp
to my module-level build.gradle.
kotlin("jvm")
was not required.
v
Vampire
09/17/2022, 2:11 AM
The
pluginManagement { plugins { ... } }
block just defines default versions for plugins if they are used in the build.