Android错误检索父级

时间:2015-03-30 15:40:34

标签: java android

我收到了这个错误...我不知道如何修复它...有人可以帮帮我吗?

我在3个文件中得到了这个,但所有3个错误相同...

错误:

  

错误:(7,-1)Android资源包装:[rpr-app]   C:\ Users *** \ Documents *** \ res \ values \ styles.xml:7:错误:错误   检索项目的父项:找不到与给定项匹配的资源   name' Theme.AppCompat.Light'。

一个文件:

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

2 个答案:

答案 0 :(得分:1)

如果您尚未安装 SDK Manager ,则需要安装支持库

然后,如果您使用 Android Studio ,那么,

来自Android Studio,与Eclipse不同:

1。打开项目的build.gradle文件。

2。包括appcompat

dependencies {
    ...
    compile "com.android.support:appcompat-v7:18.0.+"
}

或者,如果您正在使用 Eclipse ,那么

Check this answer

修改

从IDE左侧的文件树中打开build.gradle(Module: app)

enter image description here

然后将其添加到该文件并再次同步

enter image description here

答案 1 :(得分:0)

我相信您可能会针对非常低的API级别。

在AndroidManifest.xml文件中,将android:minSdkVersion更改为15。您仍然会定位大多数Android设备,而不必处理兼容性问题。