Best way to update Support Library

10,945

Solution 1

Go for API level 26. Because API 27 is in preview mode so it won't be stable for now. Change your Build.gradle file like this and sync you are good to go.

android {
compileSdkVersion 26
buildToolsVersion "26.0.3"
defaultConfig {
    applicationId "Your app ID"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
   "android.support.test.runner.AndroidJUnitRunner"

}

And you will have to update your dependencies too because they won't work in latest versions if you use the old ones. So that's why supp lib is related to android API.

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'

Solution 2

Answer to your 2nd question : You can use latest build tool version 27.0.1

buildToolsVersion '27.0.1'

You first need to download it from sdk.

Share:
10,945
Ankur Samarya
Author by

Ankur Samarya

Updated on June 16, 2022

Comments

  • Ankur Samarya
    Ankur Samarya almost 2 years

    Till now(30-Nov-2017) google has released android support lib version 27.0.2 and Android Api version 27(Preview). Right now my application have Target version 25 , Build tool version 25.0.3 and Compile sdk version 25. I am planning to update my Support Lib as well as Compile sdk version to 26. So my questions are
    1. Is Support lib version is related to android Api version means I am not updating android api to 27 because it is in preview so should I uses support lib 26.x.x or 27.x.x(which is latest).
    2. which build tool version should i use means

  • M at
    M at over 6 years
    Then why I get "Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details"
  • Umair
    Umair over 6 years
    @MahdiRafatjah you should update your build version of Sdk to latest versions.