android - 检索项目 : No resource found that matches the given name 'android:Widget.Material.Button.Colored' 的父项时出错

标签 android android-gradle-plugin android-support-library android-build

我无法构建我的项目,因为我收到此错误

Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.
Error:Execution failed for task ':app:processStageDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/john/Library/Android/sdk/build-tools/22.0.1/aapt'' finished with non-zero exit value 1
/Users/john/AndroidStudioProjects/app/build/intermediates/res/merged/stage/debug/values-v23/values-v23.xml

这是我的build.gradle

android {
def versionCodeValue = 1
def versionNameValue = "1.0"

compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.sample.test"
    minSdkVersion 17
    targetSdkVersion 22
    versionCode versionCodeValue
    versionName versionNameValue
}
}
dependencies {
  def supportLibVersion = "22.2.1"
  compile 'com.android.support:support-v4:' + supportLibVersion
  compile 'com.android.support:design:' + supportLibVersion
  compile 'com.android.support:appcompat-v7:' + supportLibVersion
  compile 'com.android.support:cardview-v7:' + supportLibVersion
  compile 'com.android.support:recyclerview-v7:' + supportLibVersion
}

更新支持库后出现此错误。我不想使用目标 SDK 23。我不想在应用程序中使用 RuntimePermission

这是我的 styles.xml

 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorPrimary</item>
    <item name="android:windowBackground">@color/colorLightGrey</item>
    <item name="android:textViewStyle">@style/myTextViewStyle</item>
    <item name="android:buttonStyle">@style/myButtonStyle</item>
    <item name="android:editTextStyle">@style/myEditTextStyle</item>
</style>

我不明白为什么它显示错误 values-v23.xml 因为我根本没有使用版本 23。它在

中显示错误
/Users/john/AndroidStudioProjects/app/build/intermediates/res/merged/stage/debug/values-v23/values-v23.xml

最佳答案

将您的 Activity 样式更改为旧样式,例如 Theme.AppCompat.Light.DarkActionBar 可能有助于同时将 AppCompatActivity 更改为 Activity。

您可以在此对话框中选择主题: enter image description here

关于android - 检索项目 : No resource found that matches the given name 'android:Widget.Material.Button.Colored' 的父项时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38355168/

相关文章:

安卓图形界面爬虫

像 Javascript 一样的 Android Java 上下文绑定(bind)

android - 使用 NDK 在 Android Studio 1.0.2 中生成 .so 文件

Android 设计支持库和 Material Design 向后兼容?

android - ListView 的 ScrollingViewBehavior

java - Android 应用中的 HTML/JS 应用

java - 在 Android fragment 中获取 Java.Lang.NullPointerException

android - 数据模型类对我的 AndroidTest 类不可见,而对主项目可见

Android 库项目 transient 依赖松散 AAR 类型

android - 以编程方式添加 TextInputLayout