I've added a stability configuration file (<https:...
# compose-android
u
I've added a stability configuration file (https://developer.android.com/jetpack/compose/performance/stability/fix#configuration-file) and got it to work fine, except when combined with configuration cache. ksp task fails with "arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, java.lang.String" Has anyone experienced anything similair? More details in🧵
Configuration file is added with:
tasks.withType(KotlinCompile).configureEach {
kotlinOptions.freeCompilerArgs += [
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:stabilityConfigurationPath=$rootDir/compose/compiler_config.conf"
]
}
this is the exception I get:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':applibs:common:kspDebugKotlin'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
...
Caused by: java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, java.lang.String
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runCompilerAsync(GradleKotlinCompilerRunner.kt:484)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompilerAsync(GradleKotlinCompilerRunner.kt:126)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin_common(KotlinCompile.kt:349)
at com.google.devtools.ksp.gradle.KspTaskJvm.callCompilerAsync$kotlin_gradle_plugin_common(KotlinFactories.kt:227)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompilerAsync$kotlin_gradle_plugin_common(KotlinCompile.kt:56)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.executeImpl(AbstractKotlinCompile.kt:324)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(AbstractKotlinCompile.kt:274)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:45)
e
ah, that's probably Groovy's GString getting in the way
and consider using build.gradle.kts which doesn't have this problem (and many others)
u
Thank you!!! That fixed the issue. Migrating to kotlin DSL is on the list of future work yes :)
(and what fixed the issue was doing:
Copy code
tasks.withType(KotlinCompile).configureEach {
    kotlinOptions.freeCompilerArgs += [
            "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
            "-P",
            "plugin:androidx.compose.compiler.plugins.kotlin:stabilityConfigurationPath=$rootDir/compose/compiler_config.conf".toString()
    ]
}
)