material-1.5.0-alpha03\res\values-v31\values-v31.xml:3:5-94: AAPT: error: resource android:color/system_neutral1_1000 not found
Asked Answered
C

7

96
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="m3_ref_palette_dynamic_neutral0">@android:color/system_neutral1_1000</color>
    <color name="m3_ref_palette_dynamic_neutral10">@android:color/system_neutral1_900</color>
    <color name="m3_ref_palette_dynamic_neutral100">@android:color/system_neutral1_0</color>
    <color name="m3_ref_palette_dynamic_neutral20">@android:color/system_neutral1_800</color>
    <color name="m3_ref_palette_dynamic_neutral30">@android:color/system_neutral1_700</color>
    <color name="m3_ref_palette_dynamic_neutral40">@android:color/system_neutral1_600</color>
    <color name="m3_ref_palette_dynamic_neutral50">@android:color/system_neutral1_500</color>
    <color name="m3_ref_palette_dynamic_neutral60">@android:color/system_neutral1_400</color>
    <color name="m3_ref_palette_dynamic_neutral70">@android:color/system_neutral1_300</color>
    <color name="m3_ref_palette_dynamic_neutral80">@android:color/system_neutral1_200</color>
    <color name="m3_ref_palette_dynamic_neutral90">@android:color/system_neutral1_100</color>
    <color name="m3_ref_palette_dynamic_neutral95">@android:color/system_neutral1_50</color>
    <color name="m3_ref_palette_dynamic_neutral99">@android:color/system_neutral1_10</color>
    <color name="m3_ref_palette_dynamic_neutral_variant0">@android:color/system_neutral2_1000</color>
    <color name="m3_ref_palette_dynamic_neutral_variant10">@android:color/system_neutral2_900</color>
    <color name="m3_ref_palette_dynamic_neutral_variant100">@android:color/system_neutral2_0</color>
    <color name="m3_ref_palette_dynamic_neutral_variant20">@android:color/system_neutral2_800</color>
    <color name="m3_ref_palette_dynamic_neutral_variant30">@android:color/system_neutral2_700</color>
    <color name="m3_ref_palette_dynamic_neutral_variant40">@android:color/system_neutral2_600</color>
    <color name="m3_ref_palette_dynamic_neutral_variant50">@android:color/system_neutral2_500</color>
    <color name="m3_ref_palette_dynamic_neutral_variant60">@android:color/system_neutral2_400</color>
    <color name="m3_ref_palette_dynamic_neutral_variant70">@android:color/system_neutral2_300</color>
    <color name="m3_ref_palette_dynamic_neutral_variant80">@android:color/system_neutral2_200</color>
    <color name="m3_ref_palette_dynamic_neutral_variant90">@android:color/system_neutral2_100</color>
    <color name="m3_ref_palette_dynamic_neutral_variant95">@android:color/system_neutral2_50</color>
    <color name="m3_ref_palette_dynamic_neutral_variant99">@android:color/system_neutral2_10</color>
    <color name="m3_ref_palette_dynamic_primary0">@android:color/system_accent1_1000</color>
    <color name="m3_ref_palette_dynamic_primary10">@android:color/system_accent1_900</color>
    <color name="m3_ref_palette_dynamic_primary100">@android:color/system_accent1_0</color>
    <color name="m3_ref_palette_dynamic_primary20">@android:color/system_accent1_800</color>
    <color name="m3_ref_palette_dynamic_primary30">@android:color/system_accent1_700</color>
    <color name="m3_ref_palette_dynamic_primary40">@android:color/system_accent1_600</color>
    <color name="m3_ref_palette_dynamic_primary50">@android:color/system_accent1_500</color>
    <color name="m3_ref_palette_dynamic_primary60">@android:color/system_accent1_400</color>
    <color name="m3_ref_palette_dynamic_primary70">@android:color/system_accent1_300</color>
    <color name="m3_ref_palette_dynamic_primary80">@android:color/system_accent1_200</color>
    <color name="m3_ref_palette_dynamic_primary90">@android:color/system_accent1_100</color>
    <color name="m3_ref_palette_dynamic_primary95">@android:color/system_accent1_50</color>
    <color name="m3_ref_palette_dynamic_primary99">@android:color/system_accent1_10</color>
    <color name="m3_ref_palette_dynamic_secondary0">@android:color/system_accent2_1000</color>
    <color name="m3_ref_palette_dynamic_secondary10">@android:color/system_accent2_900</color>
    <color name="m3_ref_palette_dynamic_secondary100">@android:color/system_accent2_0</color>
    <color name="m3_ref_palette_dynamic_secondary20">@android:color/system_accent2_800</color>
    <color name="m3_ref_palette_dynamic_secondary30">@android:color/system_accent2_700</color>
    <color name="m3_ref_palette_dynamic_secondary40">@android:color/system_accent2_600</color>
    <color name="m3_ref_palette_dynamic_secondary50">@android:color/system_accent2_500</color>
    <color name="m3_ref_palette_dynamic_secondary60">@android:color/system_accent2_400</color>
    <color name="m3_ref_palette_dynamic_secondary70">@android:color/system_accent2_300</color>
    <color name="m3_ref_palette_dynamic_secondary80">@android:color/system_accent2_200</color>
    <color name="m3_ref_palette_dynamic_secondary90">@android:color/system_accent2_100</color>
    <color name="m3_ref_palette_dynamic_secondary95">@android:color/system_accent2_50</color>
    <color name="m3_ref_palette_dynamic_secondary99">@android:color/system_accent2_10</color>
    <color name="m3_ref_palette_dynamic_tertiary0">@android:color/system_accent3_1000</color>
    <color name="m3_ref_palette_dynamic_tertiary10">@android:color/system_accent3_900</color>
    <color name="m3_ref_palette_dynamic_tertiary100">@android:color/system_accent3_0</color>
    <color name="m3_ref_palette_dynamic_tertiary20">@android:color/system_accent3_800</color>
    <color name="m3_ref_palette_dynamic_tertiary30">@android:color/system_accent3_700</color>
    <color name="m3_ref_palette_dynamic_tertiary40">@android:color/system_accent3_600</color>
    <color name="m3_ref_palette_dynamic_tertiary50">@android:color/system_accent3_500</color>
    <color name="m3_ref_palette_dynamic_tertiary60">@android:color/system_accent3_400</color>
    <color name="m3_ref_palette_dynamic_tertiary70">@android:color/system_accent3_300</color>
    <color name="m3_ref_palette_dynamic_tertiary80">@android:color/system_accent3_200</color>
    <color name="m3_ref_palette_dynamic_tertiary90">@android:color/system_accent3_100</color>
    <color name="m3_ref_palette_dynamic_tertiary95">@android:color/system_accent3_50</color>
    <color name="m3_ref_palette_dynamic_tertiary99">@android:color/system_accent3_10</color>
    <color name="m3_sys_color_dynamic_dark_background">@color/m3_ref_palette_dynamic_neutral10</color>
    <color name="m3_sys_color_dynamic_dark_inverse_on_surface">@color/m3_ref_palette_dynamic_neutral20</color>
    <color name="m3_sys_color_dynamic_dark_inverse_primary">@color/m3_ref_palette_dynamic_primary40</color>
    <color name="m3_sys_color_dynamic_dark_inverse_surface">@color/m3_ref_palette_dynamic_neutral90</color>
    <color name="m3_sys_color_dynamic_dark_on_background">@color/m3_ref_palette_dynamic_neutral90</color>
    <color name="m3_sys_color_dynamic_dark_on_primary">@color/m3_ref_palette_dynamic_primary20</color>
    <color name="m3_sys_color_dynamic_dark_on_primary_container">@color/m3_ref_palette_dynamic_primary90</color>
    <color name="m3_sys_color_dynamic_dark_on_secondary">@color/m3_ref_palette_dynamic_secondary20</color>
    <color name="m3_sys_color_dynamic_dark_on_secondary_container">@color/m3_ref_palette_dynamic_secondary90</color>
    <color name="m3_sys_color_dynamic_dark_on_surface">@color/m3_ref_palette_dynamic_neutral90</color>
    <color name="m3_sys_color_dynamic_dark_on_surface_variant">@color/m3_ref_palette_dynamic_neutral_variant80</color>
    <color name="m3_sys_color_dynamic_dark_on_tertiary">@color/m3_ref_palette_dynamic_tertiary20</color>
    <color name="m3_sys_color_dynamic_dark_on_tertiary_container">@color/m3_ref_palette_dynamic_tertiary90</color>
    <color name="m3_sys_color_dynamic_dark_outline">@color/m3_ref_palette_dynamic_neutral_variant60</color>
    <color name="m3_sys_color_dynamic_dark_primary">@color/m3_ref_palette_dynamic_primary80</color>
    <color name="m3_sys_color_dynamic_dark_primary_container">@color/m3_ref_palette_dynamic_primary30</color>
    <color name="m3_sys_color_dynamic_dark_secondary">@color/m3_ref_palette_dynamic_secondary80</color>
    <color name="m3_sys_color_dynamic_dark_secondary_container">@color/m3_ref_palette_dynamic_secondary30</color>
    <color name="m3_sys_color_dynamic_dark_surface">@color/m3_ref_palette_dynamic_neutral10</color>
    <color name="m3_sys_color_dynamic_dark_surface_variant">@color/m3_ref_palette_dynamic_neutral_variant30</color>
    <color name="m3_sys_color_dynamic_dark_tertiary">@color/m3_ref_palette_dynamic_tertiary80</color>
    <color name="m3_sys_color_dynamic_dark_tertiary_container">@color/m3_ref_palette_dynamic_tertiary30</color>
    <color name="m3_sys_color_dynamic_light_background">@color/m3_ref_palette_dynamic_neutral99</color>
    <color name="m3_sys_color_dynamic_light_inverse_on_surface">@color/m3_ref_palette_dynamic_neutral95</color>
    <color name="m3_sys_color_dynamic_light_inverse_primary">@color/m3_ref_palette_dynamic_primary80</color>
    <color name="m3_sys_color_dynamic_light_inverse_surface">@color/m3_ref_palette_dynamic_neutral20</color>
    <color name="m3_sys_color_dynamic_light_on_background">@color/m3_ref_palette_dynamic_neutral10</color>
    <color name="m3_sys_color_dynamic_light_on_primary">@color/m3_ref_palette_dynamic_primary100</color>
    <color name="m3_sys_color_dynamic_light_on_primary_container">@color/m3_ref_palette_dynamic_primary10</color>
    <color name="m3_sys_color_dynamic_light_on_secondary">@color/m3_ref_palette_dynamic_secondary100</color>
    <color name="m3_sys_color_dynamic_light_on_secondary_container">@color/m3_ref_palette_dynamic_secondary10</color>
    <color name="m3_sys_color_dynamic_light_on_surface">@color/m3_ref_palette_dynamic_neutral10</color>
    <color name="m3_sys_color_dynamic_light_on_surface_variant">@color/m3_ref_palette_dynamic_neutral_variant30</color>
    <color name="m3_sys_color_dynamic_light_on_tertiary">@color/m3_ref_palette_dynamic_tertiary100</color>
    <color name="m3_sys_color_dynamic_light_on_tertiary_container">@color/m3_ref_palette_dynamic_tertiary10</color>
    <color name="m3_sys_color_dynamic_light_outline">@color/m3_ref_palette_dynamic_neutral_variant50</color>
    <color name="m3_sys_color_dynamic_light_primary">@color/m3_ref_palette_dynamic_primary40</color>
    <color name="m3_sys_color_dynamic_light_primary_container">@color/m3_ref_palette_dynamic_primary90</color>
    <color name="m3_sys_color_dynamic_light_secondary">@color/m3_ref_palette_dynamic_secondary40</color>
    <color name="m3_sys_color_dynamic_light_secondary_container">@color/m3_ref_palette_dynamic_secondary90</color>
    <color name="m3_sys_color_dynamic_light_surface">@color/m3_ref_palette_dynamic_neutral99</color>
    <color name="m3_sys_color_dynamic_light_surface_variant">@color/m3_ref_palette_dynamic_neutral_variant90</color>
    <color name="m3_sys_color_dynamic_light_tertiary">@color/m3_ref_palette_dynamic_tertiary40</color>
    <color name="m3_sys_color_dynamic_light_tertiary_container">@color/m3_ref_palette_dynamic_tertiary90</color>
    <style name="ThemeOverlay.Material3.DynamicColors.Dark" parent="">
    <!-- Color palettes -->
    <item name="colorPrimary">@color/m3_sys_color_dynamic_dark_primary</item>
    <item name="colorOnPrimary">@color/m3_sys_color_dynamic_dark_on_primary</item>
    <item name="colorPrimaryInverse">@color/m3_sys_color_dynamic_dark_inverse_primary</item>
    <item name="colorPrimaryContainer">@color/m3_sys_color_dynamic_dark_primary_container</item>
    <item name="colorOnPrimaryContainer">@color/m3_sys_color_dynamic_dark_on_primary_container</item>
    <item name="colorSecondary">@color/m3_sys_color_dynamic_dark_secondary</item>
    <item name="colorOnSecondary">@color/m3_sys_color_dynamic_dark_on_secondary</item>
    <item name="colorSecondaryContainer">@color/m3_sys_color_dynamic_dark_secondary_container</item>
    <item name="colorOnSecondaryContainer">@color/m3_sys_color_dynamic_dark_on_secondary_container</item>
    <item name="colorTertiary">@color/m3_sys_color_dynamic_dark_tertiary</item>
    <item name="colorOnTertiary">@color/m3_sys_color_dynamic_dark_on_tertiary</item>
    <item name="colorTertiaryContainer">@color/m3_sys_color_dynamic_dark_tertiary_container</item>
    <item name="colorOnTertiaryContainer">@color/m3_sys_color_dynamic_dark_on_tertiary_container</item>
    <item name="android:colorBackground">@color/m3_sys_color_dynamic_dark_background</item>
    <item name="colorOnBackground">@color/m3_sys_color_dynamic_dark_on_background</item>
    <item name="colorSurface">@color/m3_sys_color_dynamic_dark_surface</item>
    <item name="colorOnSurface">@color/m3_sys_color_dynamic_dark_on_surface</item>
    <item name="colorSurfaceVariant">@color/m3_sys_color_dynamic_dark_surface_variant</item>
    <item name="colorOnSurfaceVariant">@color/m3_sys_color_dynamic_dark_on_surface_variant</item>
    <item name="colorSurfaceInverse">@color/m3_sys_color_dynamic_dark_inverse_surface</item>
    <item name="colorOnSurfaceInverse">@color/m3_sys_color_dynamic_dark_inverse_on_surface</item>
    <item name="colorOutline">@color/m3_sys_color_dynamic_dark_outline</item>
    <item name="colorError">@color/m3_sys_color_dark_error</item>
    <item name="colorOnError">@color/m3_sys_color_dark_on_error</item>
    <item name="colorErrorContainer">@color/m3_sys_color_dark_error_container</item>
    <item name="colorOnErrorContainer">@color/m3_sys_color_dark_on_error_container</item>
  </style>
    <style name="ThemeOverlay.Material3.DynamicColors.DayNight" parent="ThemeOverlay.Material3.DynamicColors.Light"/>
    <style name="ThemeOverlay.Material3.DynamicColors.Light" parent="">
    <!-- Color palettes -->
    <item name="colorPrimary">@color/m3_sys_color_dynamic_light_primary</item>
    <item name="colorOnPrimary">@color/m3_sys_color_dynamic_light_on_primary</item>
    <item name="colorPrimaryInverse">@color/m3_sys_color_dynamic_light_inverse_primary</item>
    <item name="colorPrimaryContainer">@color/m3_sys_color_dynamic_light_primary_container</item>
    <item name="colorOnPrimaryContainer">@color/m3_sys_color_dynamic_light_on_primary_container</item>
    <item name="colorSecondary">@color/m3_sys_color_dynamic_light_secondary</item>
    <item name="colorOnSecondary">@color/m3_sys_color_dynamic_light_on_secondary</item>
    <item name="colorSecondaryContainer">@color/m3_sys_color_dynamic_light_secondary_container</item>
    <item name="colorOnSecondaryContainer">@color/m3_sys_color_dynamic_light_on_secondary_container</item>
    <item name="colorTertiary">@color/m3_sys_color_dynamic_light_tertiary</item>
    <item name="colorOnTertiary">@color/m3_sys_color_dynamic_light_on_tertiary</item>
    <item name="colorTertiaryContainer">@color/m3_sys_color_dynamic_light_tertiary_container</item>
    <item name="colorOnTertiaryContainer">@color/m3_sys_color_dynamic_light_on_tertiary_container</item>
    <item name="android:colorBackground">@color/m3_sys_color_dynamic_light_background</item>
    <item name="colorOnBackground">@color/m3_sys_color_dynamic_light_on_background</item>
    <item name="colorSurface">@color/m3_sys_color_dynamic_light_surface</item>
    <item name="colorOnSurface">@color/m3_sys_color_dynamic_light_on_surface</item>
    <item name="colorSurfaceVariant">@color/m3_sys_color_dynamic_light_surface_variant</item>
    <item name="colorOnSurfaceVariant">@color/m3_sys_color_dynamic_light_on_surface_variant</item>
    <item name="colorSurfaceInverse">@color/m3_sys_color_dynamic_light_inverse_surface</item>
    <item name="colorOnSurfaceInverse">@color/m3_sys_color_dynamic_light_inverse_on_surface</item>
    <item name="colorOutline">@color/m3_sys_color_dynamic_light_outline</item>
    <item name="colorError">@color/m3_sys_color_light_error</item>
    <item name="colorOnError">@color/m3_sys_color_light_on_error</item>
    <item name="colorErrorContainer">@color/m3_sys_color_light_error_container</item>
    <item name="colorOnErrorContainer">@color/m3_sys_color_light_on_error_container</item>
  </style>
</resources>

Here is my v31/values-v31

While I'm trying to build this project . I'm frequently getting this error(

ERROR:C:\Users\Dell.gradle\caches\transforms-2\files-2.1\66e9dd10963e7a2704a4a2116f19e6fb\material-1.5.0-alpha03\res\values-v31\values-v31.xml:3:5-94: AAPT: error: resource android:color/system_neutral1_1000 not found.)

Solutions I tried Rebuild project, clean project, Invalidate cache and restart, enter code hereand also delete and newly create that emulator but nothing worked for me

Connell answered 3/9, 2021 at 11:54 Comment(0)
E
90

As described in the release notes:

The version 1.5.0-alpha03 introduces the new Material 3 themes and

Make sure to update your app's compileSdkVersion to 31 when using this version of the library.

Edda answered 7/9, 2021 at 5:26 Comment(0)
A
70

Short answer:

To fix the compilation error, make sure to update your app’s compileSdkVersion to 31 when using fresh versions of the Material Components library.

Or you can downgrade the Material Components library to 1.4.0 or 1.5.0-alpha02.

Explanations:

Starting from version 1.5.0-alpha03, Material Components library requires compile SDK version 31 (was raised at commit 40509dc).
See release notes on GitHub.

It is required because of the new Material 3 themes with dynamic colors support.
Starting from Android S (API 31), the framework provides the ability to support dynamic colors in your UI based on the user’s wallpaper or color choice on the device.

Read more about «Material You» wallpaper-based theming system «Monet» which underlies this functionality:
https://mcmap.net/q/219278/-how-to-use-new-material-you-colors-announced-for-android-12
https://medium.com/@xch3dx/using-material-you-in-your-app-15ec982eecb4

Ancipital answered 5/9, 2021 at 16:36 Comment(2)
this is the correct answerVitia
This is not helps.Oldline
T
23

The problem is in the following line:

implementation 'com.google.android.material:material:1.5.0-alpha03'

I used this and got the same error. Replacing it with the following line fixed the problem:

implementation 'com.google.android.material:material:1.5.0-alpha02')
Truman answered 4/9, 2021 at 15:51 Comment(3)
That seems to have fixed it for me too; thank you.Coverdale
No, it is not the real solution.Edda
But that's downgrading a dependency...Monkeypot
S
14

I've meet this error, and it's solved. Change or downgrade your dependencies should solve this issue. If you meet this error from this link, I suggest you should change this both, from :

implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.5.0'

to :

implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'

then, run your app again. I think this method works. This usually happen if you create your new project, but you didn't notice this error, when you trying to run your app.

Sonnysonobuoy answered 27/1, 2022 at 4:28 Comment(2)
thanks, it worked.Misbehave
solved my problemFredericafrederich
P
11

I ran into this error as well, when trying to target API 30 in a Java project. I had tried to downgrade the appcompat dependency only and got these errors. Turns out you need to downgrade the material dependency as well.

To target API 30, you need to downgrade both androidx.appcompat:appcompat and com.google.android.material:material to older versions.

Change the versions from:

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'

To:

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
Parrott answered 8/3, 2022 at 15:19 Comment(0)
G
2

Not quite sure if this is the solution (it worked for me) but updating the compileSdk and targerSdk to 31 alongside with updating these libraries solved the error in my case:

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.android.material:material:1.5.0'
Gamin answered 26/4, 2022 at 7:29 Comment(0)
B
-1

Follow these Steps

In build.gradle ( Module )

        apply plugin: 'com.android.application'
        apply plugin: 'com.google.gms.google-services'
        
        
        android {
            compileSdkVersion 30
            buildToolsVersion '30.0.2'
        
            defaultConfig {
                applicationId "your package name"
                minSdkVersion 21
                targetSdkVersion 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
            }
        
        }
        
        dependencies {
        
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'androidx.appcompat:appcompat:1.3.0'
            implementation 'com.google.android.material:material:1.4.0'
            implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'androidx.test.ext:junit:1.1.1'
            androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        }
    
    

In build.gradle (project) enter code here

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:4.0.1"
            classpath 'com.google.gms:google-services:4.3.3'
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

If you are using Firebase, Dont Forget to Download and paste Json file from Firebase and paste it in app folder.

Bleat answered 8/8, 2022 at 13:20 Comment(3)
You haven't shared any steps. but pasted whole file. Please clarify the steps.Burgonet
It's for who are beginners..that code will definitely help them to get rid of this errorBleat
especially to beginners u should explain what is happening where imoBurgonet

© 2022 - 2024 — McMap. All rights reserved.