java.lang.AssertionError: CALL 'public final fun <get-currentComposer>
java.lang.AssertionError: CALL 'public final fun <get-currentComposer>
我正在尝试使用 jetPack Compose 创建一个项目,我有它工作所需的所有依赖项,但是当我 运行 我的应用程序时,它抛出一个错误,我找不到解决方案
- 这是错误:
java.lang.AssertionError: CALL 'public final fun <get-currentComposer> (): androidx.compose.runtime.Composer<*> declared in androidx.compose.runtime.ComposerKt' type=androidx.compose.runtime.Composer<*> origin=FOR_LOOP_ITERATOR
- 我添加的所有依赖项
def jetpackDef = "1.0.0-alpha09"
// Jetpack compose navigation
implementation "androidx.navigation:navigation-compose:1.0.0-alpha04"
implementation "androidx.compose.ui:ui:$jetpackDef"
// Tooling support (Previews, etc.)
implementation "androidx.compose.ui:ui-tooling:$jetpackDef"
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation "androidx.compose.foundation:foundation:$jetpackDef"
// Material Design
implementation "androidx.compose.material:material:$jetpackDef"
// Material design icons
implementation "androidx.compose.material:material-icons-core:$jetpackDef"
implementation "androidx.compose.material:material-icons-extended:$jetpackDef"
// Integration with observables
implementation "androidx.compose.runtime:runtime-livedata:$jetpackDef"
implementation "androidx.compose.runtime:runtime-rxjava2:$jetpackDef"
implementation "androidx.compose.runtime:runtime:$jetpackDef"
buildFeatures {
// Enables Jetpack Compose for this module
compose true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
任何帮助将不胜感激,谢谢。
我通过设置 composeOptions 让它工作,当我有 kotlinCompilerExtensionVersion =“1.0.0-alpha08”时我得到了这个错误,而其余的库是 alpha09。
composeOptions {
kotlinCompilerVersion = "1.4.21"
kotlinCompilerExtensionVersion = "1.0.0-alpha09"
}
compose 版本 alpha09
似乎有问题,降级到 alpha08
应该可以。
对我来说 JuliusScrip 的回答并没有完全解决它:如果你在你的 build.gradle(:project)
文件中使用 ext.kotlin_version
,你也需要更新它:
buildscript {
ext.kotlin_version = "1.4.21"
...
}
对于需要更多详细信息的任何人,此视频完全是关于此错误的:https://www.youtube.com/watch?v=itvv6m4haGY&feature=emb_logo
我正在尝试使用 jetPack Compose 创建一个项目,我有它工作所需的所有依赖项,但是当我 运行 我的应用程序时,它抛出一个错误,我找不到解决方案
- 这是错误:
java.lang.AssertionError: CALL 'public final fun <get-currentComposer> (): androidx.compose.runtime.Composer<*> declared in androidx.compose.runtime.ComposerKt' type=androidx.compose.runtime.Composer<*> origin=FOR_LOOP_ITERATOR
- 我添加的所有依赖项
def jetpackDef = "1.0.0-alpha09"
// Jetpack compose navigation
implementation "androidx.navigation:navigation-compose:1.0.0-alpha04"
implementation "androidx.compose.ui:ui:$jetpackDef"
// Tooling support (Previews, etc.)
implementation "androidx.compose.ui:ui-tooling:$jetpackDef"
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation "androidx.compose.foundation:foundation:$jetpackDef"
// Material Design
implementation "androidx.compose.material:material:$jetpackDef"
// Material design icons
implementation "androidx.compose.material:material-icons-core:$jetpackDef"
implementation "androidx.compose.material:material-icons-extended:$jetpackDef"
// Integration with observables
implementation "androidx.compose.runtime:runtime-livedata:$jetpackDef"
implementation "androidx.compose.runtime:runtime-rxjava2:$jetpackDef"
implementation "androidx.compose.runtime:runtime:$jetpackDef"
buildFeatures {
// Enables Jetpack Compose for this module
compose true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
useIR = true
}
任何帮助将不胜感激,谢谢。
我通过设置 composeOptions 让它工作,当我有 kotlinCompilerExtensionVersion =“1.0.0-alpha08”时我得到了这个错误,而其余的库是 alpha09。
composeOptions {
kotlinCompilerVersion = "1.4.21"
kotlinCompilerExtensionVersion = "1.0.0-alpha09"
}
compose 版本 alpha09
似乎有问题,降级到 alpha08
应该可以。
对我来说 JuliusScrip 的回答并没有完全解决它:如果你在你的 build.gradle(:project)
文件中使用 ext.kotlin_version
,你也需要更新它:
buildscript {
ext.kotlin_version = "1.4.21"
...
}
对于需要更多详细信息的任何人,此视频完全是关于此错误的:https://www.youtube.com/watch?v=itvv6m4haGY&feature=emb_logo