Android Studio decide the exact version of a dependency to use

For example, when we need to edit app/build.gradle, we need to declare the dependency version:

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.example.user.test"
        minSdkVersion 18
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:26...'
    compile 'com.android.support:support-annotations:26....'
    androidTestCompile 'com.android.support:support-annotations:26...'
    androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support.test:rules:0.5'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
    androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
}

But how to make sure which exact version is included in version 26?

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

Just first type :

compile 'com.android.support:appcompat-v7:26.+'

Do not forget the "."!
And do sync, then focus on this dependency, ALT + ENTER, choose
Replace with specific version, and it's done :

compile 'com.android.support:appcompat-v7:26.0.0-alpha1'

你可能感兴趣的:(Android Studio decide the exact version of a dependency to use)