— Android, Jetpack, Compose, Kotlin, KSP — 1 min read
I've been thinking about rewriting one of my Flutter projects in Jetpack Compose lately and decided to get started today. I was adding some libraries and suddenly I couldn't compile my project anymore, because of a "Could not find method ksp() for arguments" error.
I was trying to add Compose Destinations to my project(I'm really liking it so far, but that's another post). To use Compose Destinations you need to add the KSP plugin. You can find the setup instructions here if you are interested.
Anyway after adding everything I couldn't run my project and I was getting some errors in the build output. There was a lot of red but what stood out to me was this:
1A problem occurred evaluating project ':app'.2> Could not find method ksp() for arguments [io.github.raamcosta.compose-destinations:ksp:1.7.27-beta] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I was using the ksp method in my dependencies like this:
1implementation 'io.github.raamcosta.compose-destinations:core:1.7.27-beta'2ksp 'io.github.raamcosta.compose-destinations:ksp:1.7.27-beta'
It turns out that I had added everything I needed to but neglected to apply the KSP plugin properly. All I needed to do was add this to the top of my app-level build.gradle
file:
1plugins {2 ...3 // Add this4 id 'com.google.devtools.ksp'5
6}
And that fixed it all up! I hope this post was useful for somebody else out there that ran into the same issue.