Does anyone know what the lowest minimum API level is for Android projects that don't require any Support Libraries? 21 or 22 was my guess but I may be wrong. I don't need any Support Library features for my future project.
Does anyone know what the lowest minimum API level is for Android projects that don't require any Support Libraries?
API Level 1. After all, the Support Library did not come into existence until after API Level 11 shipped. We developed Android apps for a few years without such a library.
If you are asking what is the min sdk to support in order not to have to use support library then the answer is there is not such a thing. You will end up using a support library in the future because android api is always being updated.
If you do not want to use library supports then you need to develop apps to use only basic features including in API 1.
Related
I'm just getting into Android development. I'll be using Xamarin.Android. Reading into this, and having toyed around with Android in the past, are AppCompat frameworks/libraries still necessary? I ask this because it seems that from Nov 1, 2019, all new app submissions require at least API Level 28 as the minimum, so what use would it be to include all these bloated appcompat libraries?
Correct me if I'm wrong or mistaken.
#wpa
AppCompat should not be necessary if you are starting a fresh new project. You can start using AndroidX libraries which will provide backwards compatibility. The requirement being mandated starting Nov 1, 2019 is not for the minimumSdk. It is for the targetSdk version. These are different. You can still have your minimumSdk to the lowest you want, but your app should target at least Android 8.0 (API level 26).
Please follow the link below for detailed information.
https://developer.android.com/distribute/best-practices/develop/target-sdk
Google requires set targetSdkVersion api level in 28 for currently apps in the Google Play Store, but if you are starting a new project, surely will start by default withe the latest android version 29.
Feel free of choose the minSdkVersion in your project.
targetSdkVersion: normally the latest android version available (for example API 29/Android 10)
minSdkVersion: the min Android SDK that your application can run on (for example since 21/ Android Lollipop)
androidx
Other hand, it is still necessary to support previous versions if your plan is to reach the majority of users using new features in old versions of android
However, according to android documentation, developers should be start projects using androidx libraries and not use appcompat library anymore.
Artifacts within the androidx namespace comprise the Android Jetpack libraries. Like the Support Library, libraries in theandroidx namespace ship separately from the Android platform and provide backward compatibility across Android releases.
https://developer.android.com/jetpack/androidx
https://developer.android.com/jetpack/androidx/versions/
https://developer.android.com/jetpack/androidx/migrate (if in the future you find an old project that needs to migrate to androidx libraries)
I am new to android app development.I don't understand what the android support library is?.Is it included in android framework APIs like API level 17,18 or is it separate API which can be included in projects.Thanks in advance!!
Is it included in android framework APIs like API level 17,18
No.
or is it separate API which can be included in projects
Yes.
Quoting the documentation:
The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running Android 1.6 (API level 4) and up.
I'm new in Android development and I'm considering if I have to use the support libraries or not.
The min SDK is 16 and target SDK is 22.
On Android docs, there is a note that is a a bit confusing to me, that is
Note: If you are including the v4 support and v7 appcompat libraries in your application, you should specify a minimum SDK version of "7" (and not "4"). The highest support library level you include in your application determines the lowest API version in which it can operate.
So if my min sdk is 16, is using support library (v4 or v13) necessary?
Or have I to use it if I want a Lollipop feature for example on Jelly Bean api 16 (via v13 support libraries)?
You use them if you need the features in them.
Do you need RecyclerView? AppCompat? CardView? Then you need support v7.
Do you need fragments and fragment transactions which are compatible with earlier version of Android? Notifications? ActionBar? Then you need support v4.
If you don't need any of these, you don't have to have them.
Have a look at developer.android.com/tools/support-library/features.html
to see which feature set they allow you to have and if you think you'd use them or not. Start without them and add them later if you need them if you're unsure.
With regards to versioning, they need a minimum version to work. If your minimum targeted version is less than their minimum required version, you should be able to use them without any problem.
When I want to create an Android app that can use the recent supported features of Android, I use libraries like:
appcompat_v7
support_v4
What I haven't been able to determine is what is the earliest version of Android that an appcompat_xxx or support library can actually support. Where do I find this information?
It's all in the name - appcompat_v7 supports API 7 and later, support_v4 supports API 4 and later.
It's also clearly stated in the docs for each library, for example:
This library is designed to be used with Android 1.6 (API level 4)
and higher.
http://developer.android.com/tools/support-library/features.html#v4
Also, although this isn't always required, you should try to match up your targetSdkVersion with the respective version of the library. For example, if your targetSdkVersion is 19, you should use com.android.support:appcompat-v7:19.+
To be clear: the support libraries, as dictated by their name, are designed to support a minimum API level. Meaning - they can be safely used on devices running that API level, as well as devices on any later API level. If you attempt to use appcompat_v7 on a donut device (API level 4), or the leanback-v17 library on a Jellybean 4.1 device (API level 16), your app will likely crash with something like a ClassNotFoundException.
The libraries were originally supposed to provide the functionality of newer API levels to the older API levels, such that you could write nearly the same code and leverage the latest platform paradigms in a single APK that would support old and new devices.
Fragments are a perfect example of this. The Fragment class was introduced with Honeycomb (API level 11). Google then released the support_v4 library which contained a back-ported version of the Fragment class and it's respective APIs. Again, as dictated by it's name, this library could be safely used in an app that supports all the way back to API 4. If you install an app using the v4 library on a API 3 device, it will crash. If you install it on, say, an API 8 device, it will work as intended.
Perhaps you're getting caught up on the seemingly delicate nature of relying on a file name to specify the min sdk version - now this is a bit of a guess, but when the v4 library was first introduced, it was just a .jar file. Meaning, you could add it to your app's classpath, no matter what minSdkVersion you use, and it would compile without complaining. MY guess is that Google wanted to explicitly name these libraries using their minimum SDK version to avoid developers trying to use them in apps that are meant to support early API versions. Aside from their docs, which again very explicitly answer your question, the filename was perhaps was a risk mitigating approach to help developers who don't read the docs.
Fast forward to 2014, many of these libraries either come in the form of .aar files (via Gradle), or you need to import them as projects. This is because these libraries now include resources such as images and themes, which cannot be packaged into a .jar file. An added benefit here is that this allows Google to include an AndroidManifest.xml with the library which specifies a minSdkVersion. At compile time, the build tools' manifest merger will complain if your minSdkVersion is lower than the minSdkVersion specified in any included library projects.
If I want to develop an app for API 7 through to 18. I understand I should set minSdkVersion to 7 in the manifest, and I assume I should set 18 as targetSdkVersion. But I'm confused by what SDK I should use for development. Should I be using the SDK for 2.1 (API 7) or 4.3 (API 18)? I don't want compatibility behaviours as I want to completely control and specify what to do on each platform version. And what about the support library? Would I use support libraries 8-18 or 1-7?
(Posted here because development questions are off-topic for android.stackexchange.com)
You can and should use the newest SDK. Eclipse or Intellij will automatically take care of letting you know if you are attempting to use a component that is only available in newer APIs. You will only want to use support library v7 and below since you intend on supporting API 7 and above. A lot of your worries will automatically be taken care of by your IDE. It will let you know if you are trying to use things that are not available in your minimum API level (which you indicate in your manifest file).