UMAR-MOBITSOLUTIONS
UMAR-MOBITSOLUTIONS

Reputation: 77984

Gradle not picking right appcompat-v7:22.2.1

I am facing a strange issue, i installed latest appcompat-v7:23.0.0 Where as i got to know i must not need it but i need to go with appcompat-v7:22.2.1 or appcompat-v7:22.0.0

I updated my gradle as per my needs but it always pickup appcompat-v7:23.0.0 which is not required, any one guide me how can i resolve this issue?

error message Appcompat-v7 installed Gradle

Upvotes: 0

Views: 240

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

AppCompat (aka ActionBarCompat) started out as a backport of the Android 4.0 ActionBar API for devices running on Gingerbread, providing a common API layer on top of the backported implementation and the framework implementation. AppCompat v21 delivers an API and feature-set that is up-to-date with Android 5.0

You can use

compile 'com.android.support:appcompat-v7:22.0.1'

Finally

android {
compileSdkVersion 22
buildToolsVersion '22.0.1' // You can set  buildToolsVersion '23.0.1' 

Advice

You should use

compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0

Good Approach : Use latest Version .

you need to download the latest support repository from internal SDK manager of Android Studio or from the stand alone SDK manager. Then you can add compile 'com.android.support:appcompat-v7:23.0.1'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId ""
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }

dependencies {

    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.google.android.gms:play-services:7.8.0' // or 8.4.0
}

Edit

You can use this classpath

classpath 'com.android.tools.build:gradle:1.3.0'

Then Clean-Rebuild-Restart-Sync your project . Hope this helps .

Upvotes: 1

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363647

Since you are using

compile 'com.google.android.gms:play-services:+'

you are using the latest version compile 'com.google.android.gms:play-services:8.4.0' which has a dependency with support libraries v23.

You have to compile with API 23.

Change this line:

 compileSdkVersion 23

If you don't want to use the api23 you can use a specific version like as

compile 'com.google.android.gms:play-services:7.8.0' 

In general is not a good practice the use of + in your dependencies because you can't replicate the build in the future with the same libraries and you don't know which version you are using.

Also you can use api23 with Httpclient.
Just use:

android {
    useLibrary 'org.apache.http.legacy'
}

More info here.

The useLibrary requires the gradle plugin 1.3.0 (classpath 'com.android.tools.build:gradle:1.3.0') or higher.

Upvotes: 1

Related Questions