AndroidX 没有找到类 "android.support.v4.content.ContextCompat"

4

这个答案对我有用:https://dev59.com/rbbna4cB1Zd3GeqPXTnd - stackwise82
2个回答

3

我刚刚解决了关于 android.support.v4.content.ContextCompat 的问题,通过导入以下库来解决:

import androidx.core.content.ContextCompat;


0
如果您尚未添加以下依赖项,请在build.gradle(Module:app)中添加它。
dependencies {
//other dependencies
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

如果想要了解新的Androidx Artifacts与旧版本构建工件的等效对应关系,请参考以下链接

https://developer.android.com/jetpack/androidx/migrate/artifact-mappings


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接