Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Is there any advantage to setting the compileSdkVersion in the manifest to less than the latest api build number, or should you always set it to the latest api build?

android {
    compileSdkVersion 22

When I say advantage I mean in terms of performance of the app, of compile time of the app, of size of the apk etc. I'm speaking, of course, of cases where you can set it lower - i.e. an app that doesn't use shared transitions or any features of lollipop.

like image 320
Jon Avatar asked Jan 07 '23 22:01

Jon


1 Answers

No, there is not.

Also, thanks to commonsware for pointing that out, but there is a difference between compileSdkVersion and targetSdkVersion. See this previous answer on Stackoverflow.

Just don't set it to the latest M Preview right now. Not that you did, I'm just saying this for new Android developers that are reading this. Android M is a preview version and it's not meant for apps in production yet.

That being said, if you're just editing the code of an application that someone wrote a couple of years ago and your boss tells you not to waste more time than you have to on a tiny little change he wants you to make, then you might as well stick to that plan and only compile to the initial api that was originally used.

Also, there is the case of security audits and certifications. If a government agency or a security company hasn't had the time to audit the latest version of an OS or sdk, then you may be stuck compiling only to the version that was last certified.

like image 169
Stephan Branczyk Avatar answered Jan 10 '23 10:01

Stephan Branczyk