Ren*_*ies 76 android kotlin android-jetpack-compose
我正在创建一个自定义,Checkbox其中Surface有Modifier.clickable:
Surface(
modifier = Modifier
.clickable(
enabled = enabled,
interactionSource = interactionSource,
indication = rememberRipple(),
role = Role.Checkbox,
onClick = { onCheckedChange(!checked) }
)
.then(modifier),
) {
Row {
Checkbox(checked = checked, onCheckedChange = {}, colors = colors)
Text(text = text ?: "")
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试构建它时,我收到错误Exception during IR lowering error:
org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /home/rene/AndroidStudioProjects/pass13/app/src/main/java/com/aresid/simplepasswordgeneratorapp/ui/widgets/Checkbox.kt
Run Code Online (Sandbox Code Playgroud)
请参阅此处的完整堆栈跟踪。
删除Modifier.clickable可以解决构建问题。
我已经尝试过升级/降级某些版本,但没有任何东西可以正常工作。
目前,我正在使用这些版本:
ext.versions = [
'compileSdk': 31,
'targetSdk' : 30,
'minSdk' : 26,
'kotlin' : '1.5.30',
'navigation': '2.3.5',
'compose' : '1.0.2'
]
Run Code Online (Sandbox Code Playgroud)
Cab*_*zas 110
就我而言,我忘记添加 build.gradle
android {
...
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
}
Run Code Online (Sandbox Code Playgroud)
Sum*_*ule 37
确保您已将 compose 添加到 gradle 中,您可以将其添加到android {...}块内。请参考以下内容添加撰写:
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
Run Code Online (Sandbox Code Playgroud)
Mob*_*ist 11
就我而言,我创建了独立模块来维护独立于功能模块的组件和主题。因此,在 android 内的模块 gradle 中更新下面的内容对我有用。
android {
.
.
.
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.0.3'
kotlinCompilerVersion '1.5.30'
}
}
Run Code Online (Sandbox Code Playgroud)
这是因为JetpackCompose!您应该在块gradle 7.2中添加这些行:build.gradleandroid
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.0.4"
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
45103 次 |
| 最近记录: |