检索项目的父项时出错:找不到与给定名称“android:TextAppearance.Material.Widget.B

时间:2023-02-02
本文介绍了检索项目的父项时出错:找不到与给定名称“android:TextAppearance.Material.Widget.Button.Borderless.Colored"匹配的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我在 android studio 中启动新项目时收到这些错误.

<块引用>

错误:(1) 检索项目的父项时出错:未找到与给定名称android:TextAppearance.Material.Widget.Button.Borderless.Colored"匹配的资源.

错误:(1) 检索项目的父项时出错:未找到与给定名称android:TextAppearance.Material.Widget.Button.Borderless.Colored"匹配的资源.

错误:任务 ':app:processDebugResources' 执行失败.com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program Files (x86)Androidandroid-sdkuild-tools23.0.2aapt.exe'' 以非零退出值 1 结束

android项目中的文件包含错误如下:

 <?xml version="1.0" encoding="utf-8"?><资源><style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored" parent="android:TextAppearance.Material.Widget.Button.Borderless.Colored"/><style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" parent="android:TextAppearance.Material.Widget.Button.Colored"/><style name="TextAppearance.AppCompat.Notification.Info.Media"/><style name="TextAppearance.AppCompat.Notification.Media"/><style name="TextAppearance.AppCompat.Notification.Time.Media"/><style name="TextAppearance.AppCompat.Notification.Title.Media"/></资源>

build.gradle:

应用插件:'com.android.application'安卓 {compileSdkVersion 23构建工具版本23.0.2"默认配置 {applicationId "com.example.anmol.checkboxapp"minSdkVersion 15targetSdkVersion 23版本代码 1版本名称1.0"}构建类型 {发布 {缩小启用假proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}}依赖{编译 fileTree(dir: 'libs', include: ['*.jar'])编译'com.android.support:appcompat-v7:25.1.0'}

如果有人解决了这个问题,请帮忙

解决方案

您编译的SDK版本必须与支持库匹配.以下一项也是如此:

1.在你的 Build.gradle 更改

编译'com.android.support:appcompat-v7:23.0.1'

2.或改变:

compileSdkVersion 23构建工具版本23.0.2"

compileSdkVersion 25构建工具版本25.0.2"

当你使用时:compile 'com.android.support:appcompat-v7:25.3.1'

我建议使用第二种方法,因为它使用的是最新的 sdk - 这样您就可以利用最新的 sdk 的新功能.

最新示例 build.gradle 与构建工具 27.0.2 --

浏览此答案 使用 Google Maven 存储库

轻松升级

编辑

如果您使用的是 Facebook 帐户工具包

不要使用:compile 'com.facebook.android:account-kit-sdk:4.+'

改为使用特定版本,例如:

编译'com.facebook.android:account-kit-sdk:4.12.0'

使用 sdk 23 的 account kit 中的最新版本存在问题

编辑

对于 Facebook Android Sdk

在您的 build.gradle 中,而不是:

编译 'com.facebook.android:facebook-android-sdk: 4.+'

使用特定版本:

编译'com.facebook.android:facebook-android-sdk:4.18.0'

Facebook sdk 中的最新版本与 Android sdk 版本 23 存在问题.

I received these errors when i started new project in android studio.

Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

Error:(1) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

Error:Execution failed for task ':app:processDebugResources'. com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:Program Files (x86)Androidandroid-sdkuild-tools23.0.2aapt.exe'' finished with non-zero exit value 1

File in android project contains error is given below:

 <?xml version="1.0" encoding="utf-8"?>
 <resources>
  <style name="Base.TextAppearance.AppCompat.Widget.Button.Borderless.Colored" parent="android:TextAppearance.Material.Widget.Button.Borderless.Colored"/>
  <style name="Base.TextAppearance.AppCompat.Widget.Button.Colored" parent="android:TextAppearance.Material.Widget.Button.Colored"/>
  <style name="TextAppearance.AppCompat.Notification.Info.Media"/>
  <style name="TextAppearance.AppCompat.Notification.Media"/>
  <style name="TextAppearance.AppCompat.Notification.Time.Media"/>
  <style name="TextAppearance.AppCompat.Notification.Title.Media"/>
 </resources>

build.gradle:

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.example.anmol.checkboxapp"
    minSdkVersion 15
    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'])
compile 'com.android.support:appcompat-v7:25.1.0'
}

If anyone have solution of this problem so please help

解决方案

Your compile SDK version must match the support library. so do one of the following:

1.In your Build.gradle change

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

2.Or change:

compileSdkVersion 23
buildToolsVersion "23.0.2"

to

compileSdkVersion 25
buildToolsVersion "25.0.2"

As you are using : compile 'com.android.support:appcompat-v7:25.3.1'

i would recommend to use the 2nd method as it is using the latest sdk - so you can able to utilize the new functionality of the latest sdk.

Latest Example of build.gradle with build tools 27.0.2 -- Source

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion "27.0.2"
    defaultConfig {
        applicationId "your_applicationID"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.android.support:design:27.0.2'
    testCompile 'junit:junit:4.12'
}

If you face problem during updating the version like:

Go through this Answer for easy upgradation using Google Maven Repository

EDIT

if you are using Facebook Account Kit

don't use: compile 'com.facebook.android:account-kit-sdk:4.+'

instead use a specific version like:

compile 'com.facebook.android:account-kit-sdk:4.12.0'

there is a problem with the latest version in account kit with sdk 23

EDIT

For Facebook Android Sdk

in your build.gradle instead of:

compile 'com.facebook.android:facebook-android-sdk: 4.+'

use a specific version:

compile 'com.facebook.android:facebook-android-sdk:4.18.0'

there is a problem with the latest version in Facebook sdk with Android sdk version 23.

这篇关于检索项目的父项时出错:找不到与给定名称“android:TextAppearance.Material.Widget.Button.Borderless.Colored"匹配的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:找不到与给定名称匹配的资源:attr 'android:keyboardNavigationCluster 下一篇:无法通过新项目从 jcenter 获取依赖项

相关文章

最新文章