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.
Related
I am using 'AppCompact' and I was implementing 'ActionMode.Callback' and I saw 2 different 'ActionMode' with same override methods. The 'android.view.ActionMode' is doing what I wanted to do in my app, but i'm little bit confused which one should i use, what is the difference between them?
The support libraries provide newer API features for older SDK versions. If your minimum SDK version is less than Lollipop (Android 5.0, API 21) then you must use the support library version of ActionMode (android.support.v7.view.ActionMode), otherwise you can use normal library version (android.view.ActionMode).
If your app minSdkVersion above Lollipop use just ActionMode , if else v7
I used the above mentioned widget in my XML. However, I'm just seeing a normal list view and not a recycler view on android 5.1. Wanted to understand if the above mentioned widget is specific to a particular OS version?
From the documentation on Android Support Libraries:
Some of the Support Library packages have package names to indicate
the minimum level of the API they originally supported, using a v#
notation, such as the support-v4 package. Starting with Support
Library version 26.0.0 (released in July 2017), the minimum supported
API level has changed to Android 4.0 (API level 14) for all support
library packages. For this reason, when working with any recent
release of the support library, you should not assume that the the v#
package notation indicates a minimum API support level. This change in
recent releases also means that library packages with the v4 and v7
are essentially equivalent in the minimum level of API they support.
For example, the support-v4 and the support-v7 package both support a
minimum API level of 14, for releases of the Support Library from
26.0.0 and higher.
v7 is just part of the package name, and refers to the version of the support library your project is using. There was an earlier version (v4), which was used with API version 4 or less (Android 1.6). Version 7 support library was a later version of the support library, which worked with newer versions of Android, and introduced new features.
Some information about it here
http://developer.android.com/tools/support-library/features.html
No this denotes the version of Android Libraries.
These libraries provide specific feature sets and can be included in
your application independently from each other.
Read more here
I'm just seeing a normal ListView
Well a Recycler View is a modification to the classical ListView. In the Layout Editor it appears like that only.
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.
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).
I am trying to create an Application on Android and want to target apps all the way down to Android 2.2.
I am a bit confused on how to configure the application
Min SDK: 2.2
Target SDK: 4.1
Compile SDK against: 4.2
This is the default config i got when i created a new Android Project.
Should i still need to use ActionBar Sherlock to support the older versions ?
Unless you are using any API's not available for lower versions, you will not require any additional libraries like ActionBarSherlock.
However, if you are using any specific API's and want to make them backward compatible, for example Fragments, ActionBar, etc then you can make use of the Support Library which supports a minimum API level of 4.
Quote from the Support Library Page:
Minimum API level supported: 4
The Support Package includes static "support libraries" that you can
add to your Android application in order to use APIs that are either
not available for older platform versions or that offer "utility" APIs
that aren't a part of the framework APIs. The goal is to simplify your
development by offering more APIs that you can bundle with your
application so you can worry less about platform versions.
ABS is an extension of the Support Library. This is from the ABS page Link: ActionBarSherlock:
The library will automatically use the native action bar when
appropriate or will automatically wrap a custom implementation around
your layouts. This allows you to easily develop an application with an
action bar for every version of Android from 2.x and up.
To summarize, if you are making use of API's not available in older SDK's, then you can use either of the two listed above. If you are not using API's specific to newer SDK's, you will not need ABS or the Support Library.
Min SDK = Least API you want to support ie., 2.2
Target SDK = API you want to test on. If not set will take default value as Min SDK. Usually target will be the Max API you want to support or the Latest API. This is to tell the Application to use the latest API Features, but if not possible allow backwards compatibility.
I never heard about Compile SDK
and you don't need any Support libraries if you are using only 2.2 API elements.
For something like Fragments etc.., which are not present in <3.0 API you must use Support Libraries.