[英]Integrate Jetpack Compose in existing project
I'm trying to add compose to my project and encountered this issue:我正在尝试将 compose 添加到我的项目中并遇到了这个问题:
org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering File being compiled: /Users/admin/app/src/main/java/ro/.../DeviceInputFragment.kt The root cause java.lang.AssertionError was thrown at: org.jetbrains.kotlin.backend.common.ir.IrUtilsKt.copyValueParametersToStatic(IrUtils.kt:264)....
I have the following configuration:我有以下配置:
Target and compile sdk set to 32目标和编译 sdk 设置为 32
composeOptions { kotlinCompilerExtensionVersion "1.1.1" } composeOptions { kotlinCompilerExtensionVersion "1.1.1" }
kotlinVersion = '1.6.10' kotlinVersion = '1.6.10'
classpath 'com.android.tools.build.gradle:7.0.4'类路径'com.android.tools.build.gradle:7.0.4'
kotlinOptions { jvmTarget = "1.8" useIR = true } kotlinOptions { jvmTarget = "1.8" useIR = true }
buildFeatures { compose = true } buildFeatures { compose = true }
composeVersion = "1.1.1"撰写版本 =“1.1.1”
implementation "androidx.compose.runtime:runtime:$composeVersion" implementation "androidx.compose.ui:ui:$composeVersion" implementation "androidx.compose.foundation:foundation:$composeVersion" implementation "androidx.compose.foundation:foundation-layout:$composeVersion" implementation "androidx.compose.material:material:$composeVersion" implementation "androidx.compose.runtime:runtime-livedata:$composeVersion" implementation "androidx.compose.ui:ui-tooling:$composeVersion"
Maybe you can provide some suggestions.也许你可以提供一些建议。
android {
...
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.0.4'//change this value
kotlinCompilerVersion '1.5.31' // change this value
}
}
Make sure you do not have composable value initialization in the init block of a class确保在 class 的 init 块中没有可组合值初始化
if nothing works.如果没有任何效果。 Delete.gradle.idea and Invalidate Caches and restart删除.gradle.idea和Invalidate Caches并重启
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.