检索项目的父项时出错:找不到与给定名称匹配的资源

时间:2017-07-21 10:27:34

标签: android gradle

如果我完成了gradle,我会收到此错误:

  

错误:(3)检索项目的父项时出错:找不到资源   匹配给定的名称   '机器人:TextAppearance.Material.Widget.Button.Borderless.Colored'。   错误:(4)检索项目的父项时出错:找不到资源   匹配给定的名称   '机器人:TextAppearance.Material.Widget.Button.Colored'。错误:(3)   检索项目的父项时出错:找不到与之匹配的资源   给定的名称   '机器人:TextAppearance.Material.Widget.Button.Borderless.Colored'。   错误:(4)检索项目的父项时出错:找不到资源   匹配给定的名称   '机器人:TextAppearance.Material.Widget.Button.Colored'。

它向我展示了这些XML代码:

<?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'
apply plugin: 'com.neenbedankt.android-apt'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.test.test"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations {
        all*.exclude group: 'org.bytedeco', module: 'javacpp-presets'
    }

    packagingOptions {
        exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
        exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    apt 'com.jakewharton:butterknife-compiler:8.0.1'
    provided 'javax.annotation:jsr250-api:1.0'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.7'
    compile 'com.jakewharton:butterknife:8.0.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.github.hotchemi:permissionsdispatcher:2.0.7'
    compile files('libs/ffmpeg.jar')
    compile files('libs/javacpp.jar')
    compile files('libs/javacv.jar')
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-moshi:2.3.0'
    compile 'com.android.support:design:25.4.0'
    compile 'com.jakewharton:butterknife:8.6.0'
    compile 'com.basgeekball:awesome-validation:2.0'
    compile 'com.facebook.stetho:stetho:1.5.0'
    compile 'com.facebook.stetho:stetho-okhttp3:1.5.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    testCompile 'junit:junit:4.12'
    testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.0'
    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.1'
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
}

1 个答案:

答案 0 :(得分:8)

  

错误:(3)检索项目的父项时出错:找不到资源   匹配给定的名字......

您应该更改 buildToolsVersion 版本。

<强>不

compileSdkVersion 23
buildToolsVersion '25.0.0'

<强>不要

compileSdkVersion 25
buildToolsVersion "25.0.2"