【问题标题】:Error in xml After Adding Google Map Activity添加 Google 地图活动后 xml 中的错误
【发布时间】:2016-06-30 10:48:21
【问题描述】:

我收到以下错误:

错误:(1) 检索项目的父项时出错:找不到资源 匹配给定的名称 'android:TextAppearance.Material.Widget.Button.Inverse'。在价值观 v-23.xml

这是我的 gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.ashwin_bhoyar.techtt"
        minSdkVersion 15
        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'])
    compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
    compile 'com.google.android.gms:play-services:8.4.0'
}

【问题讨论】:

标签: android google-maps-android-api-2


【解决方案1】:

请将此添加到您的 gradle

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

希望这会奏效

【讨论】:

    【解决方案2】:

    您的编译 SDK 版本必须与支持库的主要版本匹配。

    由于您使用的是版本 23 的支持库,因此您需要针对版本 23 的 Android SDK 进行编译。

    或者,您可以通过切换到最新的支持库 v21 继续针对 Android SDK 版本 21 进行编译。

    请查看图片中突出显示的部分

    【讨论】:

    【解决方案3】:

    我编辑了你的 gradle 代码............试试这个,我希望它的作品

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.2"
    
        defaultConfig {
            applicationId "com.example.ashwin_bhoyar.techtt"
            minSdkVersion 15
            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'])
        compile 'com.android.support:appcompat-v7:21.1.2'
        compile 'com.google.android.gms:play-services:8.4.0'
    }
    

    【讨论】:

      【解决方案4】:

      找不到与给定名称匹配的资源 'android:TextAppearance.Material.Widget.Button.Inverse'

      您应该调用 API 级别 23

      compileSdkVersion 23
      buildToolsVersion "23.1.0"
      
      defaultConfig {
          applicationId "com.example.ashwin_bhoyar.techtt"
          minSdkVersion 15
          targetSdkVersion 23
          versionCode 1
          versionName "1.0"
      }
      

      并使用

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

      【讨论】:

      • 感谢您的回复。我收到以下错误:错误:找不到构建工具修订版 23.1.0 安装构建工具 23.1.0 并同步项目我已在 sdk 管理器中更新到 23.1
      • @ashwinbhy 真的吗? Clean-Rebuild-Restart-Sync
      • buildToolsVersion "23.0.0"怎么样
      • 抱歉 amiya 在我的 sdk 中没有 buildToolsVersion 23.0.0 它的 23.0.2 我已经安装了它
      猜你喜欢
      • 1970-01-01
      • 2011-02-20
      • 2012-05-03
      • 2015-03-15
      • 1970-01-01
      • 1970-01-01
      • 2016-12-25
      • 1970-01-01
      • 2015-09-19
      相关资源
      最近更新 更多