0

I currently run :

AndroidStudio 2.2 , Android sdk 24 is also available. Android SDK-Tools 25.2.2 Android Sdk-Platform-tools 24.03 Android sdk-build-tools 24.0.1

When i create a new Blank Project this is the build gradle

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"
    defaultConfig {
        applicationId "com.example.test001"
        minSdkVersion 14
        targetSdkVersion 24
        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'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    testCompile 'junit:junit:4.12'
}

I would assume this is an app that can be installed on devices running 4.0 to 7.0 How can i change this so that it runs from 2.3.3 to 6.0, still working from the same AndroidStudio installation.Also how would it affect the other features like google-play-services, appcompat-v7,design versions.

Deepak
  • 1,200
  • 3
  • 18
  • 46
  • Try this http://stackoverflow.com/a/21667156/3669452 or this http://stackoverflow.com/a/20167880/3669452 Hope it helps. – THZ Oct 14 '16 at 07:25

2 Answers2

2
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
    applicationId "com.example.test001"
    minSdkVersion 10
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

And Change Your Dependency Also

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
Nitin Thakor
  • 475
  • 3
  • 14
1

Actually,minSdkVersion 14 means that this app can run on android os which vertion higher than 14,and 14 means android 4.0.You can change this line like this :minSdkVersion 10 then it can run on 2.3.3 and above.You also can set a maxSdkVersion to limit the highest version,but maxSdkVersion usually meaningless.

minSdkVersion and maxSdkVersion can only limit the installation of an app.If your device has a lower version or a higher version than what you set,app can't installed on this device.

But! If you want the application to work correctly on multiple versions,you must care about the difference in versions you want to support. targetSdkVersion 24 means that your application fit android7 very well and compileSdkVersion 24 means your application will be compiled with this version of SDK.

Different versions of the API or feature may have a relatively large change, or in some versions ,APIs are different.So if you want to support widely,you need to care about the difference between different version of sdk. If api not change,you can do nothing and it can run well.But if api changed,you should write code for different version.

if you change the compileVersion to 23,you should change these code:

compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'

and the support library only work on some versions.You should also care about it.

4snows
  • 51
  • 6