【问题标题】:Resource linking failed in Android StudioAndroid Studio 中的资源链接失败
【发布时间】:2021-11-22 20:37:46
【问题描述】:

我正在使用 Android Studio,我正在尝试使用 google 材料库

我收到以下错误(Android 资源链接失败):

错误:AAPT:C:\Users\ANDRES\Desktop\cursillo_android\TipTime2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v31\values-v31.xml:3:错误:资源 android :color/system_neutral1_1000 未找到。

Mi成绩文件是:

plugins {
    id 'com.android.application'
    id 'kotlin-android'
}

android {
    compileSdk 30
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.example.tiptime2"
        minSdk 24
        targetSdk 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }

    buildFeatures {
        viewBinding = true
    }

}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'com.google.android.material:material:1.5.0-alpha05'


}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()

    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.0.3"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


我想与您分享错误的图片:

谢谢

【问题讨论】:

    标签: android android-studio kotlin material-components-android


    【解决方案1】:

    当你的 targetSdk 低于 31 时,关联的支持库 使用材料资源将与您的构建配置发生冲突。

    在构建期间,gradle 将使用一个任务来检查所有支持的 .aar 库 元数据,其中设置了构建目标兼容性;如果是 com.google.android.material:material:1.5.0-alpha05' 目标兼容性 设置在 30 以上(可能是 31,甚至更高); 补救措施是这样的: 所以去一个更早的材料支持库 这里https://mvnrepository.com/artifact/com.google.android.material/material 使用材料支持类的早期支持版本;

    【讨论】:

      猜你喜欢
      • 2019-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-01
      相关资源
      最近更新 更多