找不到Theme.AppCompat

时间:2018-07-04 06:15:08

标签: android android-studio

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

build.gradle

enter image description here

styles.xml

enter image description here

AndroidManifest.xml

enter image description here

logcat

enter image description here

1 个答案:

答案 0 :(得分:0)

删除supportv4库并添加:

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

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

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">