javaandroidkotlingradle

Confused about compileSdk vs minSdK: How is it possible, that it runs on very old devices?


android {
    compileSdk = 35

    defaultConfig {
        minSdk = 24
        /* ... */
}

How is it possible that I can use modern SDK 35-features and the app works on an old device from eight years ago?

The device can't know that features. How is this downwards compatibility accomplished?

Or I'm I generally wrong in my thinking somehow?


Solution

  • Well... The SDK includes software features and innovations. Then, a compiler turns it into machine code for a certain processor (hardware) architecture. As long as the architecture is compatible the compiler should generally generate machine code that can be executable on an older but compatible processor. Then, the minSdk is a limit that you define that pertains to the software and not the hardware (processor).