2017-02-09 36 views
50

当我在android studio中开始新项目时收到这些错误。检索父项的错误:找不到与给定名称相匹配的资源'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:(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)\Android\android-sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 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> 

的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' 
} 

如果任何人有这个问题的解决方案,请帮助

回答

86

你编译SDK版本必须与支持库匹配。所以做以下的一个

1.In您Build.gradle变化

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

2.Or变化:

compileSdkVersion 23 
buildToolsVersion "23.0.2" 

compileSdkVersion 25 
buildToolsVersion "25.0.2" 

正如你使用compile 'com.android.support:appcompat-v7:25.3.1'

我会推荐使用第二种方法,因为它使用最新的sdk - 所以你可以利用最新sdk的新功能。

最新示例 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' 
} 

如果在更新版本等过程中遇到的问题:通过这个Answer使用简单的升级换代

enter image description here

转到Google Maven Repository

编辑

如果你使用Facebook Account Kit

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

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

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

有一个在帐户套件的最新版本的SDK 23

编辑问题

对于Facebook Android Sdk

中,而不是你的build.gradle

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

使用特定版本:

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

有一个在Facebook的SDK最新版本的Android SDK版本问题23

+2

感谢您指出并给予可能的解决方案,但它适用于'编译“com.android.support:appcompat-v7: 23.4.0''@ rafsanahmad007 –

+0

你在哪里做了这些变化 – manish

+0

在你的应用程序中--'build.gradle'文件 – rafsanahmad007

7

这个问题是由最近版本中的回归创建的。你可以找到解决的https://github.com/facebook/react-native-fbsdk/pull/339

+0

感谢 - 是专门;这是4.22。1版本在你提供的链接,解决了我的问题(我无法改变我的android compileSdkVersion由于其他原因) – Reece

+1

@罗德诺兰认真我想给你买一个啤酒或甜甜圈什么的,理智和头发我已经没有因为你的评论而失去这一点值得给我钱。 –

+0

我发誓,在过去的5年中,我遇到过的所有问题的单一来源,“Facebook SDK”就是榜首。跨越iOS和Android,以及不同的项目,我创建的项目以及我从其他项目中采用的项目,没有其他任何项目接近。因此,Android版Facebook SDK的一个版本(如许多版本)存在问题,并且已通过硬编码版本号解决。这是解决方案。 –

3

理想的答案在上述论坛上发现了这个问题拉入请求是这样的:

sed -i 's/facebook-android-sdk:4.+/facebook-android-sdk:4.22.1/g' ./node_modules/react-native-fbsdk/android/build.gradle 

这工作

6

我找到了,我试图编译我的应用程序正在使用Facebook的SDK。我被弄得像奥格斯特2016年当我尝试打开它今天我得到了同样的错误。我曾在我的gradle这个该行“编译‘com.facebook.android:facebook-android-sdk:4.+’”我去https://developers.facebook.com/docs/android/change-log-4x这个页面,我发现,而我是成功地运行这个程序的SDK版本,这是4.14 0.1后来我改变该行“编译‘com.facebook.android:facebook-android-sdk:4.14.1’”和它的工作。

在我的情况
3

我使用了compile sdk 23build tools 25.0.0只是改变compile sdk 25,做..

相关问题