首页 > 解决方案 > 找不到 Theme.AppCompat

问题描述

Error retrieving parent for item: No resource found that matches the
 given name 'Theme.AppCompat'.

构建.gradle

在此处输入图像描述

样式.xml

在此处输入图像描述

AndroidManifest.xml

在此处输入图像描述

日志猫

在此处输入图像描述

标签: androidandroid-studio

解决方案


删除supportv4库并添加:

implementation "com.android.support:support-core-utils:27.1.1"

并且(如果您不这样做)在您的顶级build.gradle文件中包含 Google 的 Maven 存储库(更多信息在这里)。

allprojects {
    repositories {
        google()

        // If you're using a version of Gradle lower than 4.1, you must
        // instead use:
        //
        // maven {
        //     url 'https://maven.google.com'
        // }
    }
}

还要使用实现更新编译并确保所有依赖项都更新到最新版本,例如:

implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'

最后替换样式并尝试以下操作:

<!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

推荐阅读