What is the difference between compileSdkVersion and targetSdkVersion?

前端 未结 11 2133
生来不讨喜
生来不讨喜 2020-11-22 10:44

I have looked at the documentation for building with Gradle, but I\'m still not sure what the difference between compileSdkVersion and targetSdkVersion

11条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 11:22

    My 2 cents: Compile against any version of the SDK but take care not to call any APIs that your "minimum SDK version" does not support. That means you "could" compile against the latest version of the SDK.

    As for "target version" it simply refers to what you planned to target in the first place and have possibly tested against. If you haven't done the due diligence then this is the way to inform Android that it needs to perform some additional checks before it deploys your lets say "Lollipop" targeted app on "Oreo".

    So the "target version" is obviously not lower than your "minimum SDK version" but it can't be higher than your "compiled version".

提交回复
热议问题