Skip to content Skip to sidebar Skip to footer

How To Resolve : Error Inflating Class Android.support.v7.widget.cardview

I'm totally frustrated over the bug. I completed my project and run on my device of Android version 4.4.2 and it ran sucessfully then I sucessfully uploaded in Playstore and again

Solution 1:

Use

app:backgroundTint="@drawable/megaphone"

Instead of this

 android:backgroundTint="@drawable/megaphone"

Try this

<android.support.v7.widget.CardViewandroid:layout_width="0dp"android:layout_height="wrap_content"app:layout_columnWeight="1"app:layout_rowWeight="1"android:layout_marginBottom="0dp"android:layout_marginLeft="0dp"android:layout_marginRight="0dp"app:cardElevation="8dp"app:cardCornerRadius="8dp"app:backgroundTint="@drawable/megaphone"
                >

Solution 2:

You have implemented all dependencies in glide. Try below gradle

Gradle :

dependencies {
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.firebase:firebase-storage:11.8.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation("com.github.bumptech.glide:glide:4.6.1") {
        exclude group: "com.android.support" 
     }
        implementation 'com.android.support:appcompat-v7:26.+'
        implementation 'com.android.support:support-v4:26.+'
        implementation 'com.android.support:cardview-v7:26.+'
        implementation 'com.android.support:recyclerview-v7:26.+'
        implementation 'com.google.firebase:firebase-messaging:11.8.0'
        implementation 'com.google.gms:google-services:3.1.0'
        implementation 'com.android.support:design:26.+'
        implementation 'de.hdodenhof:circleimageview:2.2.0'

        implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'
        implementation 'com.android.support:gridlayout-v7:26.+'
        implementation 'com.github.clans:fab:1.6.2'
        testCompile 'junit:junit:4.12'
        implementation 'com.google.android.gms:play-services-maps:11.8.0'
        implementation 'com.google.firebase:firebase-firestore:11.8.0'
        implementation 'id.zelory:compressor:2.1.0'
        implementation files('libs/libGoogleAnalyticsServices.jar')

    apply plugin: 'com.google.gms.google-services'
}

Solution 3:

After looking to your xml code, I found that you forgot to declare the id news and notice which causes this android.view.InflateException.

Answer : Declare these fields to the required ImageView's

Solution 4:

try to use app:cardBackgroundColor Instead, i think the tint not working on CardView

OR

for testing issues, try to replace @drawable/megaphone with any colors, maybe the problem inside the megaphone

Post a Comment for "How To Resolve : Error Inflating Class Android.support.v7.widget.cardview"