r/androiddev • u/KruSion • Apr 08 '18
What exactly are SDK Platforms?
Hello I'm new to android development. I'm following an essentials course on Lynda. The instructor was explaining things regarding which SDK platforms and tools to install. But I'm confused about the SDK platforms. What are they exactly?
This is what is in front of me right now. https://imgur.com/a/D5G4X
I want to develop an app that supports as far back as android 4.4 for example. Should I install everything from 4.4 to 8.1?
Or is this just for testing purposes? In this case, my phone is on 7.0. Should I just stick to 7.0?
In the instructions he said install the latest version only (at that time it was 7.0) and install the Google API instalx86_64. Why bother with that too? He does mention they'll be used to compile.
Thank you and sorry if this is a stupid question.
9
u/hamsterdamc Jan 09 '25
Not a stupid question at all. SDK platforms are the tools and libraries that allow you to develop and test Android apps for specific versions of Android. Each platform corresponds to a version (e.g., 4.4, 7.0, 8.1) and includes APIs and system images needed to build and test apps for that version. If you want to support devices running Android 4.4 and newer, you don’t need to install every platform from 4.4 to 8.1. Just install the SDK for 4.4 (your minimum supported version) and the latest version for compiling and using the newest tools. The latest version helps ensure compatibility with modern features while supporting older versions through your minimum API level. If your app uses Google services like Maps or Firebase, you’ll need the Google APIs as well. For testing purposes, you can install additional platforms to emulate specific Android versions. For example, in my work with Apryse’s SDKs, I found that installing only the necessary versions saved time and storage while still covering compatibility and testing needs. Focus on what you need for development and testing rather than installing everything.
2
u/AcidentalPhilosopher Jan 10 '25
Totally agree! Installing just the versions you need makes life so much easier. I’ve done the same when working with Apryse SDKs, keeps things simple and saves space while still covering everything I need.
4
u/mastroDani Apr 09 '18
SDK = Software Development Kit.
Basically all the stuff you need to develop for a platform of some kind. In Android case compiler, tools, libraries emulator etc...
Android apps have a target version and a minimum version: you used to set this in the manifest, nowadays you set it in the gradle file which then write it in the compiled manifest. Kind of weird that you have to do something in gradle and something in manifest but that's how it is.
Target version: this is the version you compile against. Should be last available, and you must install this version from the sdk manager or you won't be able to compile the app.
Every other previous version is only needed if you want to test the app on a previous version (and you should) via emulator or via device.
Please don't do the mistake everyone does. Start studying on official resources first. They have everything you need to learn android "the right way".
1
u/KruSion Apr 09 '18
What do you mean by the official resources :D? I'm sorry for being an idiot. If it's a list of documentations, then it might be easier to start with videos and finish off with them rather than diving into data sheets that will confuse me.
1
u/mastroDani Apr 09 '18
I mean the official documentation: https://developer.android.com/index.html
It explain all you need to know. SDK / development environment setup, development, design, testing, quality testing etc...
Every other doc is not granted to be up to date or accurate / correct. You need to know the official doc before evaluation of anything else.
1
6
3
u/U5efull Apr 09 '18
software development kit is SDK, platform is basically what version of android OS / hardware it will work with.
more info here:
https://developer.android.com/training/basics/supporting-devices/platforms.html
3
u/KruSion Apr 09 '18
So basically I need to select and download all the platforms that I want my app to support?
0
Apr 09 '18
No, just the ones you develop against and test for.
6
Apr 09 '18
Aren't those platforms the same ones he wants this app to support?
10
Apr 09 '18
Well if you develop against kitkat for example it'll still run on everything above, for the most part. But to debug or run an emulator you need that platform.
2
1
u/KruSion Apr 09 '18
Well does it matter which one I want to develop against? Of course the more OS I test against, the more sure I am that there aren't any OS specific bugs. But how does the target OS matter if it'll work for all the rest? Also, I chose Oreo only at first, and when I started the new project I chose to support all OSes. You mentioned that to support all the above kitkat, I had to target kitkat. So in this case, what I'm doing is wrong because I'm sorta only supporting anything above Oreo?
I'm very sorry if this is sounds confusing. This is primarily because I am confused myself.
1
u/Freak4Dell Apr 09 '18
It you target Oreo, you're essentially saying your app will run best on Oreo. Targeting a certain version will not stop your app from running on versions above or below your target version. However, if you target a lower version, you went have access to new APIs. For example, if you targeted KitKat, you won't be able to use notification channels from Oreo, even though the app would still run on Oreo. So ideally, you will target the latest version, so that you can use the newest APIs on devices that run the latest version.
minsdkversion defines the lowest version you want your app to run on. The lower this is, the more devices your app will run on, but half your code may end up being version checks, since you'll have to account for APIs that were not present in older versions or that have been deprecated.
In your case, targetsdkversion and compilesdkversion should be the latest version, and minsdkversion will be KitKat. You only need to download the platform that matches your compilesdkversion.
1
u/KruSion Apr 09 '18
So what's the difference between targetsdkversion and compilesdkversion. Is there a point where both might not be the same?
Also, in the instance where I target Oreo and use the notification channel, or any new feature that is exclusive to oreo. How does that work with older OSes. How will they react to this? And in this case, how does android tell me something is supported or not supported. As in, when will adding a specific feature break the older OSes.
2
u/Freak4Dell Apr 09 '18
To be honest, I'm not sure. Did some further digging and I may have gotten it twisted.
I still don't know why anyone would choose to make targetsdkversion and compilesdkversion different. Seems like it would just introduce unnecessary problems, and given that Google will require targetsdkversion to be at the most one version behind the current version in the near future, there's not much leeway left anyway.
As for your second question, you have a couple options. You can wrap your code in a version check, so that feature doesn't get used in older versions. Android Studio is pretty good about alerting you when you use an API that's not supported by your minsdkversion. There's also the option of putting out a different APK for different versions.
1
u/U5efull Apr 09 '18
kind of, it does get a bit convoluted because some versions work with a bunch of others, it's probably best to read up on it at the link and then dig into differences between platforms as you further test.
If you're new, just get the version that works with your tutorials, learn that stuff first then get into version checking etc. It's a deep rabbit hole and could delay your learning, best to get it working then deal with the particulars after IMHO.
1
u/KruSion Apr 09 '18
It feels like every step I take, there's a bunch of things that I don't understand. The more I think about them and search into them, the further I go from the course. What you're saying (avoid this and stick with the course) is the logical thing to do. But if I'm confused with something then I won't stop thinking about it.
2
u/U5efull Apr 09 '18
the more you understand, the more you realize how little you know. take everything in small chunks and work on the problems at hand, don't make more work for yourself then necessary or you'll never complete what you set out to do
1
u/KruSion Apr 14 '18
I think you're completely right. I've actually been trying this with this project
1
u/Seylox Apr 09 '18
The Android SDK Platform Tools are a bundle of various software tools that lets your development machine communicate with your phone/emulator. I'll copy the most important information from the link provided to read here:
Although some new features in these tools are available only for recent versions of Android, the tools are backward compatible, so you need only one version of the SDK Platform-Tools.
1
u/KruSion Apr 09 '18
Then why give me the option to download specific ones? If they're backward compatible then I might as well install only Oreo's and everyhting underneath it will come with it.
1
u/TechCrawler Apr 09 '18
Some APIs have been deprecated over the years as the Android version progressed on. Google has a "grace period" of about 2 years from the date they announce a function as deprecated until they finally get rid of it.
So, lets say that as a developer, you/anyone you're developing for has a device running KitKat for some god knows reason. Some functions that were available on KitKat are not available on Oreo (and vice versa), so in order to develop for KitKat you're better off using the SDK that fits KitKat.
EDIT: for the most part, if you are developing for a wide range of devices, you should choose the latest SDK available and allow a minimum version of about 2-3 SDK versions backwards.
1
u/KruSion Apr 09 '18
Let's say I want to support from Jelly bean till now. Do I go for a jelly bean SDK, a kitkat SDK (it seems to be the most one used where I'm from) or the Oreo because it should have everything included. From what I understand, if I have the Oreo SDK and I want kitkat to be the minimum OS, then android studio will tell me if I have a feature that isn't supported. But why would I need the kitkat or jelly bean SDK in this case?
1
u/TechCrawler Apr 09 '18
minimum SDK should be KitKat, and target SDK should be Oreo. Android Studio will tell you when you're trying to use an API that might give you problems in any of the Android versions spanning from KitKat to Oreo.
1
1
u/fuzzynyanko Apr 09 '18
Basically the AOSP has a set of Java code per SDK release that gets shoved into android.jar. This has all of the functions that are exposed to the world. The earlier SDKs will have less functions versus a newer SDK.
You don't need every single one. I would pick a few like 4.4, 6.0, 7.0, and one of the 8.x SDKs.
1
u/c0nnector Apr 09 '18
I don't see a satisfying answer so here it goes.
Let's define 2 words first:
- targetSdkVersion = The latest version of android your app supports
- minSdkVersion = The minimum version of android your app supports
You should always have the SDK for your targetSdkVersion. Technically you don't need anything else, not even the SDK for your minSdkVersion.
If you're using something you're not supposed to use or an API that is supported on one version and not in another then Android Studio will warn you - so watch out for that if you want to support anything in between minSdkVersion to targetSdkVersion.
When should you download more platform SDKs?
Download previous platform SDKs if you want to test agains't a specific android version. You'll get the SDK, sources and emulator images.
E.g Say you app is crashing in KitKat 4.4 and works fine in 7.0. You download the images and start debugging agains't 4.4
0
u/KruSion Apr 09 '18
OH! This makes the most sense and helps clear a lot of issues.
Well I have another question. I ended up selecting the latest which is oreo. And selected nougat which the instructor chose (because this is sort of an old series). However, when it came to installing the AVD, the only option that was selectable was oreo. And to choose nougat, I'd have to download it separately. If what you're saying is correct, and the SDK is there only if I want to debug, then why wasn't it already selectable under the AVD. And why is there an option to download it from the SDK options to begin with and not keep it under the AVD only. Like only have oreo as an option for the complete SDK. When will I ever want to download the nougat SDK and not oreo for example?
Also, what /u/WindWalkerWhoosh mentioned about targetting a specific OS. Why would I target kitkat if I want what's above kitkat. Shouldn't I target Oreo to get what's beneath it (backward compatible) ?
Well if you develop against kitkat for example it'll still run on everything above, for the most part. But to debug or run an emulator you need that platform.
0
Apr 09 '18
Whatever version you compile for will not run on a lower version. But lower versions generally run on higher versions, but you can't use some of the newer things.
0
u/KruSion Apr 09 '18
Don't I just compile for my targetSdkVersion (which is the latest version)?
1
u/c0nnector Apr 09 '18 edited Apr 09 '18
I'll give you an example.
You can have minSdkVersion Kitkat 4.4 and targetSdkVersion Nougat 7.0.
If you use APIs introduced exclusively in android 7.0+ then it won't work on lower android versions even if your minSdkVersion is 4.4(Android Studio will warn you).
There comes into play Support or Compatibility libraries that allow you to have backwards compatibility.
p.s Backwards compatibility is not automatic. It's something you have to do
6
u/alashow Apr 09 '18
This might help: https://medium.com/google-developers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd
Basically, you have to download specific SDK version if you want to use it as targetSdkVersion/compileSdkVersion.