代码之家  ›  专栏  ›  技术社区  ›  S.Trathi

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

  •  0
  • S.Trathi  · 技术社区  · 6 年前

    我的模块级别 build.gradle 文件如下所示。

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        defaultConfig {
            applicationId "com.appsfreelocker.puppy.pattern.lockscreen"
            minSdkVersion 16
            targetSdkVersion 21
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled true
                shrinkResources true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
            debug {
                minifyEnabled true
                shrinkResources true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        buildToolsVersion '21.1.1'
    }
    
    
    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:21.1.1'
        compile 'uk.co.chrisjenx:calligraphy:2.2.0'
        compile 'com.kila.apprater_dialog.lars:apprater-dialog:1.0.5'
        compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    }
    

    以及项目级别 建筑格拉德尔 文件如下所示:

    buildscript {
    
        repositories {
            mavenCentral()
            jcenter()
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.0.0'
    
        }
    }
    
    allprojects {
        repositories {
            jcenter()
            maven {
                url 'https://maven.google.com/'
                name 'Google'
            }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    gradle-wrapper.properties 像这样:

    #Mon Apr 09 17:06:49 IST 2018
    distributionBase=GRADLE_USER_HOME
    distributionPath=wrapper/dists
    zipStoreBase=GRADLE_USER_HOME
    zipStorePath=wrapper/dists
    distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
    

    当我尝试生成时,生成失败并出现以下错误:

    C:/Users/abc/Desktop/PuppyLockscreen    
    app/build/intermediates/res/merged/debug/values-v23/values-v23.xml  
    Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.    
    Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.   
    app/build/intermediates/res/merged/debug/values-v24/values-v24.xml  
    Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. 
    Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.    
    

    Gradle Verison是 2.10 Android插件版本为 2.0.0

    我用过 this 参考以确保我使用的是Gradle版本、Android插件版本、CompileSDK版本和buildToolsVersion的正确组合。

    请任何人指出是什么导致了错误以及如何修复它。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Gabriele Mariotti    6 年前

    此库

    compile 'com.kila.apprater_dialog.lars:apprater-dialog:1.0.5'
    

    有一个 dependency 具有

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

    然后您必须使用:

    compileSdkVersion 25