0

I am having an issue that I have three API levels downloaded 20,21 and 23. Whenever I create a new project ,API 23 will automatically be selected but I want API 20 project.

enter image description here

If I make changes in build.gradle file , like

android {
    compileSdkVersion 20 // previously 23
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.abc.xyz"
        minSdkVersion 15
        targetSdkVersion 20// previously 23
        versionCode 1
        versionName "1.0"
    }

it starts giving me numerous errors which are obvious but I'm unable to resolve them easily

enter image description here

My problem is why I can't start a new fresh API 20 project, as I don't need this for API 23.

Do I need to put different APIs in different directories?or there is any other way to achieve this

SSH
  • 1,609
  • 2
  • 22
  • 42
  • And the errors you are getting are? Why do you want to use an API 20 project? You can compile with 23 but target 20 without a problem. – LordRaydenMK Nov 05 '15 at 10:10
  • @LordRaydenMK as my organizations's other apps are at API 20, as you suggested that I can have different compile and target level, can you point me any explanation for this, I think this is the point where I am getting confuse..that after compiling code with 23 i'll unable to run with lower devices... – SSH Nov 05 '15 at 10:13
  • also I have updated the screenshot with errors I first getting after making changes to gradle, if I remove these style, it then points to some other places and keep going until i get confuse what to do, – SSH Nov 05 '15 at 10:18

2 Answers2

0

In android studio goto FILE -> Project Structure

and change Compiled sdk version and apply changes chnage compile sdk

Rahul_Pawar
  • 572
  • 1
  • 8
  • 16
  • this is what I am doing and getting errors as I mentioned, I need to know for where I can change the default api 23 to API 20 – SSH Nov 05 '15 at 10:46
0

I'm assuming you are using v23 of the support libraries.

To use v23 of the support libraries your compileSdk need to be set to 23. Source

You can read about the difference between targetSdk and compileSdk here and here.

You are getting errors because you have compileSdk set to 20 and you are using support libraries v23.

You can either increase the compileSdk to 23 or use older support libraries.

I don't see a reason not to target API 23 and target API 20.

Community
  • 1
  • 1
LordRaydenMK
  • 13,074
  • 5
  • 50
  • 56