【问题标题】:"Error:(2) Error retrieving parent for item No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'“错误:(2)检索项目的父项时出错找不到与给定名称'android:TextAppearance.Material.Widget.Button.Inverse'匹配的资源
【发布时间】:2016-09-19 11:30:18
【问题描述】:

Gradle 有问题!!

它一直显示错误,有人可以帮我解决这个问题

注意:我是第一次安装android studio

【问题讨论】:

标签: android android-studio gradle android-gradle-plugin android-support-library


【解决方案1】:

试试这个:

compile 'com.android.support:appcompat-v7:24.1.0'

使用最新的支持库并更改您的目标并编译 sdk

compileSdkVersion 24

buildToolsVersion "24.0.1"

targetSdkVersion 24

【讨论】:

    【解决方案2】:

    试试看

    编译“com.android.support:appcompat-v7:23.0.1”

    您可以更改 targetSdkVersion 23

    【讨论】:

      【解决方案3】:

      请使用我的项目 gradle 值并更新 sdk 库:

      apply plugin: 'com.android.application'
      
      android {
          compileSdkVersion 23
          buildToolsVersion "23.0.1"
      
          defaultConfig {
              multiDexEnabled true
              applicationId "com.example.student"  //change as your package name
              minSdkVersion 16
              targetSdkVersion 23
              versionCode 1
              versionName "1.0"
          }
          buildTypes {
              release {
                  minifyEnabled false
                  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              }
          }
      }
      
      dependencies {
          compile fileTree(dir: 'libs', include: ['*.jar'])
          testCompile 'junit:junit:4.12'
      
      
      
          compile 'com.android.support:appcompat-v7:23.0.1'
      
      
      }
      

      【讨论】:

      • 通过 sdk 管理器,或者您只需运行新的空项目,它会显示错误并链接以更新项目所需的库。
      • 请问我可以在这行写什么:
      • applicationId "com.example.student" //改成你的包名
      • 你的新项目包名
      • 它肯定会为你工作,当问题解决时告诉我。
      【解决方案4】:

      尝试匹配所有版本:

      compileSdkVersion 23 buildToolsVersion '23.0.0' targetSdkVersion 23

      添加以下依赖项: 编译'com.android.support:appcompat-v7:23.0.0'

      确保您使用最新版本的 SDK: how to update sdk

      【讨论】:

      【解决方案5】:

      问题是你正在使用

      compile 'com.android.support:appcompat-v7:19.+'

      为您提供 Android 4.4.2 Kitkat API 19 及更早版本的所有可能性。

      在您的项目中,您尝试使用属于较新版本的 Material Themes,我的意思是 com.android.support:appcompat:$version,其中版本 > 21。

      Material Design 是在 Android 5.1 Lollipop API 21 中引入的

      我强烈建议您将 build.gradle 文件更改为:

      apply plugin: 'com.android.application'
      
      android {
          compileSdkVersion 24
          buildToolsVersion "24.0.2"
      
      defaultConfig {
          minSdkVersion 21
          targetSdkVersion 21
          versionCode 1
          versionName "1.0"
      }
      
          buildTypes {
              release {
                  minifyEnabled false
                  proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              }
          }
      }
      
      dependencies {
          compile fileTree(dir: 'libs', include: ['*.jar'])
          testCompile 'junit:junit:4.12'
          compile "com.android.support:appcompat-v7:24.2.1"
      }
      

      但当然要将 appcompat 库更改为版本:

      com.android.support:appcompat-v7:23.0.1"
      

      就够了;-)

      希望对你有帮助

      【讨论】:

        猜你喜欢
        • 2016-03-18
        • 2013-10-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-10-27
        • 2014-06-04
        • 2017-02-10
        相关资源
        最近更新 更多