Leos Literak
Leos Literak

Reputation: 9474

Why compiled APK does not respect minSdkVersion?

I have created a sample project from an Android Studio with minSDKVersion=17. I opened compiled APK from app\build\outputs\apk\ as a zip file and went to res directory. It contains a lot of directories for legacy stuff of versions older than minSDK. Why? It holds bogus 43 KB that will be never used.

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "vectordrawable.lelisoft.com.showvectordrawable"
        minSdkVersion 17
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
    }
    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:23.4.0'
    compile 'com.android.support:design:23.4.0'
}

APK:

  1. res\color-v11
  2. res\drawable-mdpi-v4
  3. res\layout-sw600dp-v13
  4. res\mipmap-hdpi-v4

Upvotes: 1

Views: 48

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006869

All of those directories will be valid on API Level 17+ devices. 17 is higher than 13, 11, and 4. Android apps might pull resources from those directories, if there is not a resource that is a better match.

Upvotes: 1

Related Questions