检索项目的父项时出错:找不到与给定名称匹配的资源'android:TextAppearance.Material.Widget.Button.Borderless.Colored'

Anm*_*wan 68 android android-gradle-plugin

当我在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:进程'命令'C:\ Program Files(x86)\ Android\android-sdk\build-tools\23.0.2\aapt .exe''以非零退出值1结束

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

 <?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>
Run Code Online (Sandbox Code Playgroud)

的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'
}
Run Code Online (Sandbox Code Playgroud)

如果有人有这个问题的解决方案所以请帮助

raf*_*007 117

您的编译SDK版本必须与支持库匹配.请执行以下操作之一:

1.在你的Build.gradle变化中

compile 'com.android.support:appcompat-v7:23.0.1'
Run Code Online (Sandbox Code Playgroud)

2.或改变:

compileSdkVersion 23
buildToolsVersion "23.0.2"
Run Code Online (Sandbox Code Playgroud)

compileSdkVersion 25
buildToolsVersion "25.0.2"
Run Code Online (Sandbox Code Playgroud)

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

我建议使用第二种方法,因为它使用最新的sdk - 所以你可以使用最新的sdk的新功能.

build.gradle的最新示例,包含构建工具27.0.2 - 源代码

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'
}
Run Code Online (Sandbox Code Playgroud)

如果您在更新版本时遇到问题,例如:

在此输入图像描述

通过此答案,使用Google Maven Repository轻松升级

编辑

如果您使用的是Facebook帐户套件

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

而是使用特定的版本,如:

compile 'com.facebook.android:account-kit-sdk:4.12.0'
Run Code Online (Sandbox Code Playgroud)

使用sdk 23的帐户套件中的最新版本存在问题

编辑

对于Facebook Android Sdk

在你build.gradle而不是:

compile 'com.facebook.android:facebook-android-sdk: 4.+'
Run Code Online (Sandbox Code Playgroud)

使用特定版本:

compile 'com.facebook.android:facebook-android-sdk:4.18.0'
Run Code Online (Sandbox Code Playgroud)

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

  • 感谢您指出并提供可能的解决方案,但它适用于`compile'c​​om.android.support:appcompat-v7:23.4.0'` @ rafsanahmad007 (2认同)

小智 7

此问题是由最近发布的回归创建的.您可以在https://github.com/facebook/react-native-fbsdk/pull/339找到修复此问题的拉取请求


Mam*_*ami 6

我找到了,我试图编译我的应用程序,这是使用Facebook sdk.我的成就就像2016年的2016年.当我今天尝试打开它时,我得到了同样的错误.我在我的gradle"compile'c​​om.facebook.android:facebook-android-sdk:4.+'"中有那条线,我去了https://developers.facebook.com/docs/android/change-log-4x这个页面,我找到了sdk版本,而我成功运行此应用程序,它是4.14.1然后我将该行更改为"编译'com.facebook.android:facebook-android-sdk:4.14.1'"并且它工作.


Nil*_*kar 6

在我的情况下,我正在使用compile sdk 23,build tools 25.0.0只是改为compile sdk25并完成..