1

Am using androidx support library, Included the library for

com.google.android.material:material:1.1.0-alpha05

am getting the error while building the application, I haven't used any card view in my application.

Android resource linking failed

error: resource style/CardView (aka com.app.myapp:style/CardView) not found.
error: style attribute 'attr/cardElevation (aka com.app.myapp:attr/cardElevation)' not found.

error: style attribute 'attr/cardBackgroundColor (aka com.app.myapp:attr/cardBackgroundColor)' not found.

error: style attribute 'attr/cardCornerRadius (aka com.app.myapp:attr/cardCornerRadius)' not found.

error: failed linking references.

Already tried using SO Thread1 ,SO Thread2 ,SO Thread3

But haven't found any solution yet.

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.core:core-ktx:1.1.0-alpha05'
    implementation 'androidx.cardview:cardview:1.0.0' // Included
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0-alpha05'
    implementation 'com.jakewharton.timber:timber:4.7.1'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.nabinbhandari.android:permissions:3.8'
    implementation project(':volley-master')
    testImplementation 'junit:junit:4.12'

}

I can't able to use any view with "com.google.android.material" same error, please help me solve it.

livemaker
  • 464
  • 1
  • 9
  • 19

2 Answers2

1

First, try to remove the below dependencies as com.google.android.material:material:1.1.0-alpha05 already have them and it will automatically pull the correct versions.

implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation 'androidx.cardview:cardview:1.0.0'
// Remove it also if you are not using anything from the legacy support library.
implementation 'androidx.legacy:legacy-support-v4:1.0.0' 

Also, make sure that the compileSdkVersion is 28 which you have already done.

After resolving the issues, you can try again to use the specific versions one by one if required.

0

Probably that is a problem with themes and styles. Probably one of your libraries is expecting that style to be available and it's not finding it.

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="cardViewStyle">@style/CardView</item>
</style>
Anik Dey
  • 616
  • 8
  • 17