Android Studio: What is the right way to change targetSdkVersion?

后端 未结 3 888
感动是毒
感动是毒 2020-12-31 04:19

I want to change the targetSdkVersion from 19 to 18 in Android Studio (not Eclipse), but failed.

Android Studio complains the following after I changed the targetSdk

相关标签:
3条回答
  • 2020-12-31 04:51

    in build.gradle Change these values according to current project Updation in sdk manager

    compileSdkVersion 25 buildToolsVersion "25.0.2" minSdkVersion 15 targetSdkVersion 25

    in dependencies replace below code
    compile 'com.android.support:appcompat-v7:25.1.0'

    and synchronise project

    0 讨论(0)
  • 2020-12-31 04:56

    How to change targetSdkVersion and minSdkVersion in Android studio

    Did have the same issue but mange to nail it down after a couple of hours.

    Step 1

    Open build.gradle - *Path\Your_Application\app\build.gradle*

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    

    Change targetSdkVersion & minSdkVersion values to what you desire.

    Step 2

    In Android stuido menu find "Build" ( alt + b @ windows ) and choose "Clean project"

    Hope this help others with the same issue.

    0 讨论(0)
  • 2020-12-31 05:07

    Alternatively, click on File > Project Structure > Application > Flavours > Min Sdk Version and press ok on change. You can also change the Target Sdk Version as well. I think this is a neater approach to editing the gradle build file directly.

    0 讨论(0)
提交回复
热议问题