LocalContext.current 上没有默认上下文

No default context on LocalContext.current

使用 LocalContext.current 会导致应用程序崩溃并告诉我:

java.lang.IllegalStateException: No default context
        at androidx.glance.CompositionLocalsKt$LocalContext.invoke(CompositionLocals.kt:35)
        at androidx.glance.CompositionLocalsKt$LocalContext.invoke(CompositionLocals.kt:35)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at androidx.compose.runtime.LazyValueHolder.getCurrent(ValueHolders.kt:29)
        at androidx.compose.runtime.LazyValueHolder.getValue(ValueHolders.kt:31)
        at androidx.compose.runtime.ComposerImpl.resolveCompositionLocal(Composer.kt:1776)
        at androidx.compose.runtime.ComposerImpl.consume(Composer.kt:1746)
        at com.bqubique.quran_randomayah.view.VerseCardKt.ButtonTile(VerseCard.kt:282)
        at com.bqubique.quran_randomayah.view.ComposableSingletons$VerseCardKt$lambda-2.invoke(VerseCard.kt:79)
        at com.bqubique.quran_randomayah.view.ComposableSingletons$VerseCardKt$lambda-2.invoke(VerseCard.kt:79)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
        at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
        at
...

使用的版本:

compose_version = '1.0.5'

wear_compose_version = '1.0.0-alpha15'

我试过在任何类型的 @Composable 中调用 LocalContext.current,甚至在 setContent{...}

中的 MainActivity.kt 中也是如此

我想导入失败了。我正在导入:

import androidx.glance.LocalContext

而不是:

import androidx.compose.ui.platform.LocalContext