Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What version of support library is installed in my Android Studio

I tried to add a CardView in my app so I added the following dependency in my gradle

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

I realised that an error is caused because I have given the wrong version number. After taking a look at the official google docs I came to know that Android Support Repository is used to hold appcompat libraries. enter image description here

As you can see the Support repository that I have installed is version 33. But if I change my gradle to version 33 it is still showing error.

How can I check what version of AppCompatLibrary I have in android studio?

EDIT:

build.gradle file

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
    compileSdkVersion 22
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.spintum.preexam"
        minSdkVersion 19
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
repositories {
    mavenCentral()
}
dependencies {
    //    compile fileTree (dir:'libs',include:'achartengine-*.jar')
    //compile fileTree('libs/achartengine-1.1.0.jar')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:percent:22.2.0'
    compile 'com.android.support:design:22.2.1'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.android.support:cardview-v7:+'
    //compile 'com.android.support:recyclerview-v7:22.2.+'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile 'com.google.android.gms:play-services-auth:8.3.0'
    compile 'com.google.android.gms:play-services-identity:8.3.0'
    compile 'com.google.android.gms:play-services-plus:8.3.0'
    compile 'com.google.android.gms:play-services-location:8.3.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.github.markushi:circlebutton:1.1'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
}
like image 384
Tyson Avatar asked Jul 05 '16 16:07

Tyson


2 Answers

The easist way is to use + which means the newest one (of the API level) on your machine, then you do not need to check the SDK folder anymore. e.g.,

compile 'com.android.support:appcompat-v7:21.+'
compile 'com.android.support:support-v4:21.+'

However, there is an warning void using 21.+ ....".

like image 92
Leon Avatar answered Sep 20 '22 09:09

Leon


It is not about the installed version of the Android Support Repository.

The version that should be in the Gradle Build Files should be the number highest version corresponding to your

compileSdkVersion

in your AppLevel Gradle Build File.(by default it is the app module).

Example:

If you are using compileSdkVersion 23 , then you should check your following directory for the highest 23.x.x folder.

\ YOUR-SDK-PATH \extras\android\m2repository\com\android\support\cardview-v7

Suppose that your highest number starting from 23 is 23.4.0 , then you should use this version number(23.4.0 replacing the 33.0.0) for your Gradle Build File(Not the verison of Android Support Repository Installed).

It means you have to use the Android Support Repository Libraries according to your compileSdkVersion.

like image 41
Saini Avatar answered Sep 21 '22 09:09

Saini