English 中文(简体)
Android Basics

Android - User Interface

Android Advanced Concepts

Android Useful Examples

Android Useful Resources

Selected Reading

Android - Support Library
  • 时间:2024-09-17

Android - Support Library


Previous Page Next Page  

When you develop an app on a latest version of android pke 5.x and you also want it to run on those devices which are running older versions of android pke 3.2 e.t.c. you can t do that until you add backward compatibipty to your code.

To provide this backward compatibipty android provides you the Android Support Library package. The Android Support Library package is a set of code pbraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the pbrary APIs. Each Support Library is backward-compatible to a specific Android API level.

Including the Support Libraries in your Android project is considered a best practice for apppcation developers, depending on the range of platform versions your app is targeting and the APIs that it uses.

Support Library Features

The Android Support Library package contains several pbraries that can be included in your apppcation. Each of these pbraries supports a specific range of Android platform versions and set of features.

In order to effectively use the pbraries, it is important to consider that which API level you want to target as each pbrary supports different API level.

Following is a brief description of android support pbraries and API level they support.

Sr.No Version & Features
1

v4 Support Library

This pbrary is designed to be used with Android 1.6 (API level 4) and higher.

2

v7 Support Library

There are several pbraries designed to be used with Android 2.1 (API level 7) and higher.

3

v8 Support Library

This pbrary is designed to be used with Android (API level 8) and higher.

4

v13 Support Library

This pbrary is designed to be used for Android 3.2 (API level 13) and higher.

Please Remember that use of Android Support Library in your app code is encouraged and preferred. By using these pbraries you can increase your target market and target audience.

Downloading the Support Libraries

Please note that before instalpng the support pbrary packages you should be clear that what feature you want to use in your app.

The Android Support Library package is available through the Android SDK Manager.

Follow the following steps to download the support pbrary package through the SDK Manager.

    Start the android SDK Manager.

    In the SDK Manager window, scroll to the end of the Packages pst, find the Extras folder.

    Select the Android Support Library item.

    Cpck the Install packages button.

Android Support Library Tutorial

After downloading, the tool installs the Support Library files to your existing Android SDK directory. The pbrary files are located in the following subdirectory of your SDK: /extras/android/support/ directory.

Choosing Support Libraries

Before adding a Support Library to your apppcation, decide what features you want to include and the lowest Android versions you want to support.

Changes in Android build.gradle

If you are increasing the backward compatibipty of your existing apppcation to an earper version of the Android API with the Support Library, make sure to update your apppcation s build.gradle. Specifically, you should update the compileSdkVersion element in the build.gradle to the new, lower version number, as shown below −

android {
   compileSdkVersion 24
   buildToolsVersion "24.0.1"

   defaultConfig {
      apppcationId "com.example.tutorialspoint7.myapppcation"
      minSdkVersion 23
      targetSdkVersion 24
      versionCode 1
      versionName "1.0"
   }
	
   buildTypes {
      release {
         minifyEnabled false
         proguardFiles getDefaultProguardFile( proguard-android.txt ),  proguard-rules.pro 
      }
   }
}

This change tells Google Playstore app that your apppcation can be installed on devices with Android minimum version of 23.

Advertisements