'material-1.5.0-alpha03\res\values-v31\values-v31.xml:3:5-94: AAPT: error: resource android:color/system_neutral1_1000 not found
<?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 here
and also delete and newly create that emulator but nothing worked for me
Solution 1:[1]
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.
Solution 2:[2]
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
or1.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://stackoverflow.com/a/69065800/1816338
https://medium.com/@xch3dx/using-material-you-in-your-app-15ec982eecb4
Solution 3:[3]
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')
Solution 4:[4]
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.
Solution 5:[5]
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 this 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'
Solution 6:[6]
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'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gabriele Mariotti |
Solution 2 | |
Solution 3 | allexiusw |
Solution 4 | Mr Alexander Ws |
Solution 5 | |
Solution 6 | BMU |