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'
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,939评论 0 23
  • 那时花开,是草长莺飞,万物葱茏的一派景象。天地不知何时从混沌中,豁地一下开了一道口子,无限的霞光从彼处洒下来。看似...
    安安的歌阅读 292评论 0 4
  • 工作,启动我的能量。我喜欢精神饱满,笑容灿烂,目光有神的自己。那样的状态,散发出层层的能量,每层能量都散...
    智爱189阅读 134评论 0 0
  • 周末,和老公一起去看望他的大学同学和家人,同学老婆刚生完二胎,儿女双全,有房有车,工作稳定,早已办好了上海户口,短...
    人间八月阅读 276评论 0 1
  • 喜欢一个人总是笨拙的。我总是在想如果那天能重来就好了。无法回头也无法前进。安慰自己这是结果,表面无所谓的我一直在期...
    小圆sky阅读 199评论 0 0