jean
11/15/2023, 2:07 PM* Where:
Build file '…/build.gradle.kts' line: 91
* What went wrong:
Could not create an instance of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget.
> Could not generate a decorated class for type KotlinAndroidTarget.
> com/android/build/gradle/api/BaseVariant
* Exception is:
org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget.
...
Caused by: java.lang.ClassNotFoundException: com.android.build.gradle.api.BaseVariant
at org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader.findClass(VisitableURLClassLoader.java:186)
... 217 more
I do have
id("com.android.library") version androidVersion apply false
and
resolutionStrategy {
eachPlugin {
if (requested.id.namespace == "com.android") {
useModule("com.android.tools.build:gradle:$androidVersion")
}
}
}
in my root settings.gradle.kts and id("com.android.library")
in build.gradle.kts of my module.
The error points to line 91 which is
androidTarget {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
I did not have any problem when using only one module though.
Any ideas on how to fix that?jamshedalamqaderi
11/15/2023, 2:10 PMandroid()
instead of androidTarget
jean
11/15/2023, 2:11 PMandroid()
is deprecated anyway)id("com.android.library") apply false
to the build.gradle.kts file on root level. Little weird but it works 🤷🏻 I do have other problems with ksp now though Could not create task :logic:compileKotlinIosArm64
(logic is the name of the module where I moved my existing code)