I'm integrating the PhotoEditor SDK into a Flutter project. The official example uses an older Kotlin version (1.7), but since it's outdated, I migrated the Android code to use Kotlin 1.9.23.
Now, I'm facing a Gradle build failure related to the Kotlin Symbol Processing (KSP) plugin.
Here’s the full error:
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/macbook/Documents/Flutter/Projects/Mine/pesdk-flutter/example/android/settings.gradle.kts' line: 22
* What went wrong:
Plugin [id: 'com.google.devtools.ksp', version: '1.9.23-1.0.16', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.9.23-1.0.16')
Searched in the following repositories:
Google
MavenRepo
Gradle Central Plugin Repository
maven(https://artifactory.img.ly/artifactory/imgly)
What I have tried:
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven("https://artifactory.img.ly/artifactory/imgly")
}
}
This is the Github Repo link to the example I am migrating to Kotlin from groovy
Question:
How can I resolve the error where the KSP plugin can't be found after migrating to Kotlin 1.9.23? Is there a mismatch between Kotlin and KSP versions, or a repository issue?
Solution:
The KSP version 1.0.16 was the issue. Changing KSP to 1.0.19 was the solution.
The first part of the KSP version must match the Kotlin version you use.
The second part is the version of KSP itself.
You must find a matching combination of both. KSP 1.0.16 is not available for Kotlin 1.9.23. Only versions 1.0.19 and 1.0.20 can be used. You need to update the KSP version to 1.9.23-1.0.20
.
For a full list of all available KSP versions see here: https://github.com/google/ksp/releases