I am working with Android Studio, and I am trying to use google material library
I am getting the following error (Android resource linking failed):
ERROR:AAPT: C:UsersANDRESDesktopcursillo_androidTipTime2appbuildintermediatesincrementalmergeDebugResourcesmerged.dirvalues-v31values-v31.xml:3: error: resource android:color/system_neutral1_1000 not found.
Mi grade files are:
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
}
I would like to share a picture of the error with you:
Thank you
2
Answers
When your targetSdk is below 31 then the support library associated
with material resources will be in conflict with your build configuration.
During the build, gradle will use a task to check all support .aar libraries
metadata, where build target compatibility is set; in the case of
com.google.android.material:material:1.5.0-alpha05′ the target compatibility
is set above 30 (may be 31, or even higher);
Remedy is this:
So go to an earlier material support library from
here https://mvnrepository.com/artifact/com.google.android.material/material
to use an earlier support version of the material support class;
Try removing ‘implementation ‘com.google.android.material:material:1.10.0-alpha01’ in gradle(Module), works fine.