android - java.lang.AssertionError : CALL 'public final fun <get-currentComposer>

标签 android kotlin android-jetpack-compose

我正在尝试使用 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"
        }
    

    关于android - java.lang.AssertionError : CALL 'public final fun <get-currentComposer>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65462221/

    相关文章:

    android - 如何找到 android 项目支持的实际最小 API 级别?

    java - 方便放置更改日志的地方

    android - 使用网络连接发送 UTF8 字符集

    android - 为什么 TextView 中的文本在回收器 View 中被截断?

    android - jetpack compose 中重复使用具有重复代码的列

    android - 从 Jetpack Compose 导航到 Fragment 以及从 Fragment 导航到 Jetpack Compose 屏幕

    android - autoMirrored 属性在 jetpack compose 中不起作用

    java - 如何将变量/值添加到 ListView 并将其发送到新 Activity

    android - OkHttp3 无法与 Kotlin (Android) 一起使用,出现 fatal error

    android - 在撰写 TextField 中格式化数字