Error inflating class and android.support.v7.widget.CardView

后端 未结 15 1600
-上瘾入骨i
-上瘾入骨i 2020-11-27 20:47

I want to use CardView in my project, but when I run my application, I get the following error. I\'m using Eclipse.

Error: Error inflating clas         


        
15条回答
  •  迷失自我
    2020-11-27 21:23

    Disable the androidx from gradle.properties file using true --> false

    android.useAndroidX=false

    android.enableJetifier=false

    then change these lines to api v28 in build.gradle(Module:app)

    compileSdkVersion 28

    targetSdkVersion 28

    then add these line in to build.gradle(Module:app)

    `implementation 'com.android.support:appcompat-v7:28.0.0'`
    `implementation 'com.android.support:recyclerview-v7:28.0.0'`
    `implementation 'com.android.support:cardview-v7:28.0.0'`
    `implementation 'com.android.support:design:28.0.0'`
    

    Then sync the project

提交回复
热议问题