How to configure the versions in the dependencies so as not to have compatibility problems?

1

I was adding the corresponding dependency, in the Gradle / Module: app file to work with CardView: compile 'com.android.support:cardview-v7:24.2.0'. But I'm marking errors in that line added and in the app: compat. Both due to incompatible versions problem.

Errors: the first is in the app line: compat:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.3.1, 24.2.0. Examples include com.android.support:animated-vector-drawable:25.3.1 and com.android.support:cardview-v7:24.2.0 more... (Ctrl+F1)

the second one is in the CardView aggregate dependency:

This support library should not use a different version (24) than the compileSdkVersion (25)

Dependency block in the file:

compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.android.support:design:25.3.1' compile 'com.android.support:cardview-v7:24.2.0' testCompile 'junit:junit:4.12'

What should be the correct way to place them to avoid that error?

    
asked by Armando Arellano 26.05.2017 в 03:31
source

1 answer

1

Android Studio suggests using the latest versions of the compatibility libraries, and these should be a compatible version defined in:

android {
    compileSdkVersion ??
    ...
    ...
}

In your case you have defined version 25 for that reason you get the following message:

  

This support library should not use a different version (24) than the   compileSdkVersion (25)

in the case of your dependencies the main problem is in the library of CardView , I suggest you change to the version:

compile 'com.android.support:cardview-v7:25.3.1'

To know which is the latest version and configure, place the mouse pointer over the dependency and it will tell you what is the latest version:

    
answered by 26.05.2017 / 23:17
source