简体   繁体   中英

Why my project always download appcompat v7 version 23 when i setting in gradle is appcompat v7 version 22?

i use libgdx to make a game ,import BaseGameUltis into my project and setting in gradle file is :

compile "com.android.support:appcompat-v7:22.2.+"

But in folder BaseGameUtils\\build\\intermediates\\exploded-aar\\com.android.support\\appcompat-v7 always version 23.0.0 and i get this error because i can't complie with android version 23, BaseGameUltis is not compatible with android ver 23:

BaseGameUtils\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.0.0\res\values-v23\values-v23.xml
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
Error:(2) Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.Button.Colored'.

This is my gradle file:

apply plugin: 'android-library'

repositories {
    mavenCentral()
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

dependencies {
    compile 'com.android.support:support-v4:20.0.+'
    compile 'com.google.android.gms:play-services:+'
    compile "com.android.support:appcompat-v7:22.2.+"
}

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"
    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 22
    }
    productFlavors {
    }
}

What do i do wrong? Thank for help.

Fix your dependency to a static version by deleting the plus symbol (+) in the end of declaration like compile "com.android.support:appcompat-v7:22.2.x"`

For more information check it here in gradle documentation

You need to compile with api 23.
Change in your build.gradle this line:

 compileSdkVersion 23

Since you are using the

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

you are using the the latest version 8.4.0 which has a dependency with support libraries v23 . It is the reason because gradle uses the v23 instead of v22.

In general it is a good practice avoiding the use of + in your build.gradle files because in this way you don't know which version you are using of your dependencies and you will not able to reproduce your code in the future.

Also don't use different version of the support libraries. In your case your trying to use com.android.support:appcompat-v7:22 and com.android.support:support-v4:20.

Finally, use gradle myModule:dependencies to check the full list of your module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM