2017-05-29 258 views
2

我正在尝试升级到新版本的Facebook sdk,并运行到200多个“找不到匹配xxx错误的资源”。在Android Studio中添加facebook sdk会导致“找不到资源”错误

我见过很多非常相似的问题/答案,但没有有用的结果。任何指针?

在模块build.gradle的这里添加facebook库行会导致错误;删除它可以修复错误。

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 15 
    buildToolsVersion '25.0.3' 

    defaultConfig { 
     applicationId "com.mazerace.android" 
     minSdkVersion 15 
     targetSdkVersion 25 
     compileOptions { 
      sourceCompatibility JavaVersion.VERSION_1_7 
      targetCompatibility JavaVersion.VERSION_1_7 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     } 
    } 
} 

dependencies { 
    compile project(':mazeRaceAndroidCommon') 
    compile project(':mazeRaceCommon') 
    compile project(':mazeRaceConnection') 
    compile 'com.google.firebase:firebase-ads:10.0.1' 
    compile 'com.facebook.android:facebook-android-sdk:4.23.0' 
} 

apply plugin: 'com.google.gms.google-services' 

的gradle项目:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.2' 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
     mavenCentral() 
    } 
} 

上输出的(部分):

Information:Gradle tasks [:mazeRace:generateDebugSources, :mazeRace:mockableAndroidJar, :mazeRace:prepareDebugUnitTestDependencies, :mazeRace:generateDebugAndroidTestSources, :mazeRaceAndroidCommon:generateDebugSources, :mazeRaceAndroidCommon:generateDebugAndroidTestSources, :mazeRaceAndroidCommon:mockableAndroidJar, :mazeRaceAndroidCommon:prepareDebugUnitTestDependencies] 
C:\Users\Jay\Documents\projects\MazeRace\AndroidStudio\mazeRace\build\intermediates\res\merged\debug\values-ldltr-v21\values-ldltr-v21.xml 
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'. 
Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner.Underlined'. 
C:\Users\Jay\Documents\projects\MazeRace\AndroidStudio\mazeRace\build\intermediates\res\merged\debug\values-v17\values-v17.xml 
Error:(4, 21) No resource found that matches the given name: attr 'android:textAlignment'. 
Error:(8, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(11, 21) No resource found that matches the given name: attr 'android:layout_marginEnd'. 
Error:(14, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(17, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. 
Error:(20, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. 
Error:(21, 21) No resource found that matches the given name: attr 'android:textAlignment'. 
Error:(25, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(24, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
Error:(28, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. 
Error:(31, 21) No resource found that matches the given name: attr 'android:layout_toStartOf'. 
Error:(34, 21) No resource found that matches the given name: attr 'android:layout_alignParentEnd'. 
Error:(38, 21) No resource found that matches the given name: attr 'android:layout_toEndOf'. 
Error:(37, 21) No resource found that matches the given name: attr 'android:layout_toStartOf'. 
Error:(41, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. 
Error:(45, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(44, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
Error:(49, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(48, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
Error:(4, 21) No resource found that matches the given name: attr 'android:textAlignment'. 
Error:(8, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(11, 21) No resource found that matches the given name: attr 'android:layout_marginEnd'. 
Error:(14, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(17, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. 
Error:(20, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. 
Error:(21, 21) No resource found that matches the given name: attr 'android:textAlignment'. 
Error:(25, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(24, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
Error:(28, 21) No resource found that matches the given name: attr 'android:layout_alignParentStart'. 
Error:(31, 21) No resource found that matches the given name: attr 'android:layout_toStartOf'. 
Error:(34, 21) No resource found that matches the given name: attr 'android:layout_alignParentEnd'. 
Error:(38, 21) No resource found that matches the given name: attr 'android:layout_toEndOf'. 
Error:(37, 21) No resource found that matches the given name: attr 'android:layout_toStartOf'. 
Error:(41, 21) No resource found that matches the given name: attr 'android:layout_marginStart'. 
Error:(45, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(44, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
Error:(49, 21) No resource found that matches the given name: attr 'android:paddingEnd'. 
Error:(48, 21) No resource found that matches the given name: attr 'android:paddingStart'. 
C:\Users\Jay\Documents\projects\MazeRace\AndroidStudio\mazeRace\build\intermediates\res\merged\debug\values-v21\values-v21.xml 
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. 
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'. 
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'. 
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'. 
Error:(216) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'. 
Error:(218) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'. 
Error:(176) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'. 
Error:(189) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'. 
Error:(10) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. 
Error:(264) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'. 
Error:(276) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'. 
Error:(7) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. 
Error:(8) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'. 
Error:(9) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'. 
Error:(11) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'. 
Error:(12) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'. 
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'. 
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'. 
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'. 
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'. 
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'. 
Error:(20) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. 
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. 
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'. 
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'. 
Error:(27) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'. 
Error:(29) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'. 
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'. 
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'. 
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'. 
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. 
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'. 
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. 
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'. 
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'. 
Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'. 
Error:(47) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'. 
Error:(49, 21) No resource found that matches the given name: attr 'android:fontFamily'. 
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. 
Error:(55) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. 
Error:(57) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. 
Error:(58) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'. 
Error:(59) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. 
Error:(61) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. 
Error:(106, 21) No resource found that matches the given name: attr 'android:colorAccent'. 
Error:(110, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'. 
Error:(108, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. 
Error:(109, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. 
Error:(107, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. 
Error:(104, 21) No resource found that matches the given name: attr 'android:colorPrimary'. 
Error:(105, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. 
Error:(113, 21) No resource found that matches the given name: attr 'android:windowElevation'. 
Error:(153, 21) No resource found that matches the given name: attr 'android:colorAccent'. 
Error:(157, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'. 
Error:(155, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. 
Error:(156, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. 
Error:(154, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. 
Error:(151, 21) No resource found that matches the given name: attr 'android:colorPrimary'. 
Error:(152, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. 
Error:(160, 21) No resource found that matches the given name: attr 'android:windowElevation'. 
Error:(163, 21) No resource found that matches the given name: attr 'android:windowElevation'. 
Error:(165) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabText'. 
Error:(167) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionBar.TabView'. 
Error:(169) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. 
Error:(171) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.CloseMode'. 
Error:(174) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton.Overflow'. 
Error:(179) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button'. 
Error:(180) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless'. 
Error:(181) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Borderless.Colored'. 
Error:(184) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Small'. 
Error:(185) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ButtonBar'. 
Error:(186) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.CheckBox'. 
Error:(187) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.CompoundButton.RadioButton'. 
Error:(188) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.DropDownItem.Spinner'. 
Error:(192) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ImageButton'. 
Error:(193) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. 
Error:(195) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabText'. 
Error:(197) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.ActionBar.TabView'. 
Error:(199) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Light.PopupMenu'. 
Error:(203, 21) No resource found that matches the given name: attr 'android:overlapAnchor'. 
Error:(205) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListPopupWindow'. 
Error:(207) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView'. 
Error:(208) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ListView.DropDown'. 
Error:(210) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.PopupMenu'. 
Error:(214, 21) No resource found that matches the given name: attr 'android:overlapAnchor'. 
Error:(220) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.RatingBar'. 
Error:(221) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.SeekBar'. 
Error:(222) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Spinner'. 
Error:(223) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.TextView.SpinnerItem'. 
Error:(224) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Toolbar.Button.Navigation'. 
Error:(232, 21) No resource found that matches the given name: attr 'android:colorAccent'. 
Error:(236, 21) No resource found that matches the given name: attr 'android:colorButtonNormal'. 
Error:(234, 21) No resource found that matches the given name: attr 'android:colorControlActivated'. 
Error:(235, 21) No resource found that matches the given name: attr 'android:colorControlHighlight'. 
Error:(233, 21) No resource found that matches the given name: attr 'android:colorControlNormal'. 
Error:(230, 21) No resource found that matches the given name: attr 'android:colorPrimary'. 
Error:(231, 21) No resource found that matches the given name: attr 'android:colorPrimaryDark'. 
Error:(240) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.NoActionBar'. 
Error:(252) Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light.NoActionBar'. 
Error:(265) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Info'. 
Error:(272) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Time'. 
Error:(17) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Inverse'. 
Error:(19) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large.Inverse'. 
Error:(25) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium.Inverse'. 
Error:(32) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small.Inverse'. 
Error:(216) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar'. 
Error:(218) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ProgressBar.Horizontal'. 
Error:(176) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.AutoCompleteTextView'. 
Error:(189) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.EditText'. 
Error:(10) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. 
Error:(264) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'. 
Error:(276) Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Title'. 
Error:(7) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material'. 
Error:(8) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body1'. 
Error:(9) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Body2'. 
Error:(11) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Caption'. 
Error:(12) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display1'. 
Error:(13) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display2'. 
Error:(14) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display3'. 
Error:(15) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Display4'. 
Error:(16) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Headline'. 
Error:(18) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Large'. 
Error:(20) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. 
Error:(22) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. 
Error:(24) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Medium'. 
Error:(26) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Menu'. 
Error:(27) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Subtitle'. 
Error:(29) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.SearchResult.Title'. 
Error:(31) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Small'. 
Error:(33) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Subhead'. 
Error:(34) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Title'. 
Error:(35) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. 
Error:(37) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle.Inverse'. 
Error:(39) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. 
Error:(41) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title.Inverse'. 
Error:(43) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Subtitle'. 
Error:(45) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionMode.Title'. 
Error:(47) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button'. 
Error:(49, 21) No resource found that matches the given name: attr 'android:fontFamily'. 
Error:(53) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Large'. 
Error:(55) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.PopupMenu.Small'. 
Error:(57) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Button'. 
Error:(58) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.TextView.SpinnerItem'. 
Error:(59) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Subtitle'. 
Error:(61) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.ActionBar.Title'. 
Error:(106, 21) No resource found that matches the given name: attr 'android:colorAccent'. 

回答

1

编辑:真正的问题:

compileSdkVersion 15 

应该

compileSdkVersion 25 

通常你想要最新的编译版本和最新的编译工具。 Here's a nice article


试试这个:

compile('com.facebook.android:facebook-android-sdk:4.23.0') { 
    exclude group: 'com.android.support', module: 'cardview-v7' 
    exclude group: 'com.android.support', module: 'appcompat-v7' 
    exclude group: 'com.android.support', module: 'support-v4' 
    exclude group: 'com.android.support', module: 'customtabs' 
} 
+0

改善,但失败。 注意详细说明这是干什么?C:\ Users \ Jay \ Documents \ projects \ MazeRace \ AndroidStudio \ mazeRace \ build \ intermediates \ res \ merged \ debug \ values \ values.xml错误:(327)错误检索项目的父项:未找到与给定名称'@ style/Theme.AppCompat.NoActionBar'匹配的资源。 – Jay

+0

测试此'编译'com.android.support:appcompat-v7:25.1.1'' –

+0

假设你的意思是添加该行,这使我回到原来的267错误。 – Jay

相关问题