AndroidX找不到类“ android.support.v4.content.ContextCompat

时间:2019-08-28 06:35:28

标签: android

  

A /合子:java_vm_ext.cc:534] JNI在应用程序中检测到错误:JNI   调用GetStaticMethodID并带有未决异常   java.lang.ClassNotFoundException:找不到类   路径上的“ android.support.v4.content.ContextCompat”:DexPathList [[zip   文件   “ /data/app/packagename-fNlt_Hyr4Uv4lFVItkfrgg==/base.apk"],nativeLibraryDirectories=[/data/app/packagename-fNlt_Hyr4Uv4lFVItkfrgg==/lib/arm,   /data/app/packagename-fNlt_Hyr4Uv4lFVItkfrgg==/base.apk!/lib/armeabi-v7a,   / system / lib,/ vendor / lib]]

 @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
            MultiDex.install(this);

    }

2 个答案:

答案 0 :(得分:1)

我刚刚通过导入以下库解决了涉及library(sf) library(sp) library(ggplot2) library(dplyr) sf_states %>% filter(!(NAME_1 %in% c("Alaska","Hawaii"))) %>% mutate(COLOR = ifelse(NAME_1 %in% c("Oregon","Florida"),"green","red")) %>% ggplot() + geom_sf(aes(fill = COLOR), show.legend = FALSE)+ scale_fill_identity() 的问题:

sf_states %>% filter(!(NAME_1 %in% c("Alaska","Hawaii"))) %>% mutate(COLOR = ifelse(NAME_1 %in% c("Oregon","Florida"),1,0)) %>% ggplot() + geom_sf(aes(fill = as.factor(COLOR)), show.legend = FALSE)+ scale_fill_manual(values = c("red","green"))

答案 1 :(得分:0)

如果您未添加以下依赖项,请将其添加到build.gradle(Module:app)

dependencies {
//other dependencies
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
}

要从旧的构建工件中了解新的Androidx工件的等效内容,请参阅以下链接

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