Java – Android: Is there an advantage to setting compileSdkVersion to a version lower than the latest API?

Android: Is there an advantage to setting compileSdkVersion to a version lower than the latest API?… here is a solution to the problem.

Android: Is there an advantage to setting compileSdkVersion to a version lower than the latest API?

What are the benefits of setting compileSdkVersion in a list to less than the latest API build number, or should it always be set to the latest API build?

android {
    compileSdkVersion 22

When I say advantages, I mean the performance of the application, the compilation time of the application, the size of the apk, etc. Of course, I’m talking about apps that you can set it lower – i.e. apps that don’t use any of the features of shared transitions or Lollipop.

Solution

No.

Also, thanks to commonsware for pointing this out, but there are differences between compileSdkVersion and targetSdkVersion. Look at this previous answer on Stackoverflow.

Don’t set it to the latest M preview version now. It’s not that you did, I’m just saying this to new Android developers who are reading this. Android M is in preview and is not yet available for applications in production.

That being said, if you’re just editing the code for an application someone wrote a few years ago, and your boss tells you not to waste more time on the small changes he wants you to make than you have to spend, then you might as well stick to that plan and only compile to the initial API you originally used.

In addition, there are security audits and certifications. If a government agency or security firm doesn’t have time to review the latest version of an operating system or SDK, you might only be able to compile to the last certified version.

Related Problems and Solutions