I imported my newly created library in a simple app. I tried running the app and kept on getting the same error. Already tried multiple solutions but I still can't get rid of this error.
Colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200" type="color">#FFBB86FC</color>
<color name="purple_500" type="color">#FF6200EE</color>
<color name="purple_700" type="color">#FF3700B3</color>
<color name="teal_200" type="color">#FF03DAC5</color>
<color name="teal_700" type="color">#FF018786</color>
<color name="black" type="color">#FF000000</color>
<color name="white" type="color">#FFFFFFFF</color>
</resources>
Themes.xml
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Library" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
Sample Error that I keep on having:
Android resource linking failed
.library-mergeDebugResources-35:/values/values.xml:142: error: resource attr/colorPrimaryVariant (aka .library:attr/colorPrimaryVariant) not found.
error: resource style/Theme.MaterialComponents.DayNight.DarkActionBar (aka .library:style/Theme.MaterialComponents.DayNight.DarkActionBar) not found.
.library-mergeDebugResources-35:/values/values.xml:134: error: style attribute 'attr/colorPrimary (aka .library:attr/colorPrimary)' not found.
.library-mergeDebugResources-35:/values/values.xml:135: error: style attribute 'attr/colorPrimaryVariant (aka .library:attr/colorPrimaryVariant)' not found.
Dependencies
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation project(path: ':library')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'}