Why can the Android Launcher Shortcuts code be compiled when minSdkVersion is 21?

  android

I’m learning the Android Launcher Shortcuts.

The code A is from the office sample project.

I know that the Launcher Shortcuts API requires Android 7.1 (API 25) or higher.

The Code A can be compiled and run after I replace minSdkVersion 25 with minSdkVersion 21, why?

Code A

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.example.android.shortcutsample"
        minSdkVersion 25  //The app can be compiled if I replace it with minSdkVersion 21
        targetSdkVersion 28
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

Source: Android Questions

LEAVE A COMMENT