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.
Related
I am going to build a new app, targeting API21 and higher, do I need AppCompat v7 or I can omit it?
It depends on what features you want to implement and which functionalities you want to develop. Targeting API level and minimum API level are both different thing. Your selection of support libraries depends upon your your minimum API level, that is defined by minSdkVersion.
You can decide and derive below conclusion from official Android Developer Documentation:
v4 Support Library
This library is designed to be used with Android 2.3 (API level 9) and higher. It includes the largest set of APIs compared to the other libraries, including support for application components, user interface features, accessibility, data handling, network connectivity, and programming utilities.
v7 Libraries
There are several libraries designed to be used with Android 2.3 (API level 9) and higher. These libraries provide specific feature sets and can be included in your application independently from each other.
v7 AppCompat library
This library adds support for the Action Bar user interface design pattern.
Note: This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part of this library's classpath.
v13 Support Library
This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support for the Fragment user interface pattern with the (FragmentCompat) class and additional fragment support classes.
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.
I'm trying to implement cursor loaders into my android app. When I write the code for LoaderManagers, eclipse prompts me to import the correct libraries. However there are two options which appear to be the same; android.app and android.support.v4.app. Whats the difference between these two, and which one should I use?
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.
This both are different library android.app is for the i.e. Fragment which are available from the API level 3.0 and above. So to use the Fragments in below api's you have to use its backword compatible libraries form android.support.v4.app to support below the API level than 3.0. So android has provided the flexibility to provide the support in lower version using android.support.v4.app library.
Each Support Library is backward-compatible to a specific Android API level. So whenever you are implmenting anything which is available in 3.0 but not below then you should use its support library.
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'm writing an app and I want to use the new ActionBar that is available in Android 3.x and later for Android. The app still needs to support the majority of devices out there and most are running 2.x releases.
I've configured my project so that the minSdk is set to API 8 and targetSDK is API 14.
My question is what is best practice for using new SDK features like the ActionBar and still support older devices running older builds of Android that don't support such features?
I would suggest using ActionBarSherlock. It provides backwards compatability for the ICS ActionBar, among other things.
Use v7-appcompat support library.
Check here: http://developer.android.com/tools/support-library/features.html
For setup: https://developer.android.com/tools/support-library/setup.html