Android - update the com.android.support:cardview-v7 support library to version 27.0.2.

Problem updating Android Support Libraries from version 27.0.1 to 27.0.2

Kind of problem: after changing versions from 27.0.1 to 27.0.2 I will have problems with my CardView, as some of the CardView attributes were not found.

To "resolve" this in the easiest way: return to version 27.0.1

But I rather would like to resolve it in another way, to upgrade to version 27.0.2

So my questions are:

  • Why am I getting these errors and how can I resolve this?

  • Is this some kind of bug in Lint to advise updated support libraries while they are not yet available? This last question, because if I look at the SDK Tools (Android Studio 3.0), then I see that the most current version of the Android SDK Platform and PlatPlatform-Tools is 27.0.1.

Below are the details of my situation.

1. **Usage in XML layout file:**

        <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                card_view:cardBackgroundColor="?attr/myCardBackgroundColor"
                card_view:cardCornerRadius="5dp"
                card_view:contentPadding="10dp">


2 .**build.gradle (Project zzz):**

        allprojects {
            repositories {
                jcenter()
                google()
                maven {
                    url 'https://maven.google.com/'
                }
            }
        }


3. **build.gradle (Module:app):**

        apply plugin: 'com.android.application'

        android {
            signingConfigs {
                config {
                    storeFile file('sssssssssssssssssssssssssssssss')
                    keyAlias 'aaaaaaa'
                    keyPassword 'bbbbbbbb'
                    storePassword 'ccccccccc'
                }
            }
        compileSdkVersion 27    
        defaultConfig {
            applicationId "xxx.yyy.zzz"
            minSdkVersion 16
            targetSdkVersion 27

            versionCode dd
            versionName 'dd.ee.ff'

            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

            signingConfig signingConfigs.config

            vectorDrawables.useSupportLibrary = true
        }

        buildTypes {
            release {
                shrinkResources true
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
                debuggable false
                jniDebuggable false
                renderscriptDebuggable false
                pseudoLocalesEnabled true
                }
            }

            productFlavors {
            }
        }

        dependencies {

 testImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
                exclude group: 'com.android.support', module: 'support-annotations'
        })
            testImplementation 'junit:junit:4.12'

            implementation fileTree(include: ['*.jar'], dir: 'libs')
            implementation 'org.jetbrains:annotations-java5:15.0'

            implementation 'com.android.support.constraint:constraint-layout:1.0.2'

            implementation 'com.android.support:appcompat-v7:27.0.1'
            implementation 'com.android.support:cardview-v7:27.0.1'
            implementation 'com.android.support:design:27.0.1'
            implementation 'com.android.support:support-annotations:27.0.1'

            implementation 'com.google.android.gms:play-services-location:11.8.0'
            implementation 'com.google.android.gms:play-services-vision:11.8.0'

            implementation 'com.google.firebase:firebase-crash:11.8.0'
            implementation 'com.google.firebase:firebase-core:11.8.0'

    implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') { transitive = true }


            implementation 'me.dm7.barcodescanner:zxing:1.9.8'
        }

        apply plugin: 'com.google.gms.google-services'
        apply plugin: 'io.fabric'



Everything is working OK and as expected.


NOW WHEN I UPGRADE 27.0.1 to 27.0.2:


4. **build.gradle (Module:app)**:

        implementation 'com.android.support:appcompat-v7:27.0.2'
        implementation 'com.android.support:cardview-v7:27.0.2'
        implementation 'com.android.support:design:27.0.2'
        implementation 'com.android.support:support-annotations:27.0.2'

And synchronizing the project, I will get the following errors:

Error:error: attribute 'xxx.yyy.zzz:cardBackgroundColor' not found.
Error:error: attribute 'xxx.yyy.zzz:cardCornerRadius' not found.
Error:error: attribute 'xxx.yyy.zzz:contentPadding' not found.

And when I look in the Gradle console, I will find this:

Gradle Console:

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]

Configuration on demand is an incubating feature.
Could not find google-services.json while looking in [src/debug]
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
Could not find google-services.json while looking in [src/release]
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection)
:app:preBuild UP-TO-DATE
:app:preDebugBuild
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: /home/user/AndroidStudioProjects/Project/app/google-services.json
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest
:app:fabricGenerateResourcesDebug
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources
AGPBI: {"kind":"error","text":"error: attribute \u0027xxx.yyy.zzz:cardBackgroundColor\u0027 not found.","sources":[{"file":"/home/user/AndroidStudioProjects/Project/app/src/main/res/layout/activity.xml"}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: attribute \u0027xxx.yyy.zzz:cardCornerRadius\u0027 not found.","sources":[{"file":"/home/user/AndroidStudioProjects/Project/app/src/main/res/layout/activity.xml"}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"error: attribute \u0027xxx.yyy.zzz:contentPadding\u0027 not found.","sources":[{"file":"/home/user/AndroidStudioProjects/Project/app/src/main/res/layout/activity.xml"}],"original":"","tool":"AAPT"}

A bit boring as Lint tells me that there is a newer version of the supporting library for CardView:

A newer version of com.android.support:cardview-v7 than 27.0.1 is available: 27.0.2

Now I have disabled this check as follows:

    //noinspection GradleDependency
    implementation 'com.android.support:cardview-v7:27.0.1'

Read this issue:

Failed to solve: com.android.support:cardview-v7:26.0.0 android

But that did not help me solve this problem.

And I read many other articles on the Internet, but they had nothing to do with my problem.

+4
2

27.1.1, , , . , , , , , , , .

0

compileSdkVersion 27, buildToolsVersion?

:

compileSdkVersion 27
buildToolsVersion '26.0.2'
+2

Source: https://habr.com/ru/post/1692196/


All Articles