'Version 28 is the latest version of the legacy support

Hello iam trying to add this library :compile 'com.android.support:cardview-v7:28.0.0\n' but getting error: Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with this: Refactor > Migrate to AndroidX...

any fix?



Solution 1:[1]

Bro its very simple just change com.android.support:cardview-v7:(your targetsdkversion digits).0.0

instead of com.android.support:cardview-v7:28.0.0...it will work

Solution 2:[2]

Use the following dependencies instead of old ones in gradle scripts on Module level

dependencies {
    implementation 'androidx.preference:preference:1.2.0'
    implementation 'androidx.appcompat:appcompat:1.4.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.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
Solution 2 M22