How to Add Support Library to Android Studio Project? - GeeksforGeeks

23 Jun, 2021
An android support library is part of Android SDK tools. You can use the Android Support Library for backward-compatible versions of new Android features and additional UI elements and features not included in the standard Android framework. Each package in the support library has a version number in three parts (X.Y.Z) that correspond to an Android API level, and a particular library revision For example, a support library version number of 22.3.4 is version 3.4 of the support library for API 22.
As a general rule, use the most recent version of the support library for the API your app is compiled and targeted for, or a newer version. For example, if your app targets API 25, use version 25.X.X of the support library.
Step 1: In Android Studio, select Tools > Android > SDK Manager, or click the SDK Manager icon. The SDK Manager preference pane appears.
Step 2: Click the SDK Tools tab and expand the Support Repository.
Step 3: Look for Android Support Repository in the list.
If Installed appears in the Status column, you’re all set. Click Cancel.
If Not installed or Update Available appears, click the checkbox next to Android Support Repository. A download icon should appear next to the checkbox. Click OK.
Step 4: Click OK again, and then Finish when the support repository has been installed.
The Gradle scripts for your project manage how your app is built, including specifying your app’s dependencies on other libraries. To add a support library to your project, modify your Gradle build files to include the dependency to that library you found in the previous section.
Step 1: In Android Studio, make sure the Project pane is open and the Android tab is clicked.
Step 2: Expand Gradle Scripts, if necessary, and open the build.gradle (Module: app) file. Note that build.gradle for the overall project (build.gradle (Project: app_name) is a different file from the build.gradle for the app module.
Step 3: Locate the dependencies section of build.gradle, near the end of the file. The dependencies section for a new project may already include dependencies in several other libraries.
Step 4: Add a dependency for the support library that includes the statement you copied in the previous task. For example, a complete dependency on the design support library looks like this:
compile 'com.android.support:design:23.3.0'
Step 5: Update the version number, if necessary. If the version number you specified is lower than the currently available library version number, Android Studio will warn you that an updated version is available. (“a newer version of com.android.support:design is available”). Edit the version number to the updated version, or type Shift+Enter and choose “Change to XX.X.X” where XX.X.X is the updated version number.
Step 6: Click Sync Now to sync your updated Gradle files with the project, if prompted.
Your Gradle file will look something like this in the above picture.
Android-Studio
Picked
Android
Android
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Resource Raw Folder in Android Studio
Flutter - Custom Bottom Navigation Bar
How to Read Data from SQLite Database in Android?
How to Post Data to API using Retrofit in Android?
Retrofit with Kotlin Coroutine in Android
How to Get Current Location in Android?
Android Listview in Java with Example
How to Save Data to the Firebase Realtime Database in Android?
Flexbox-Layout in Android
How to Change the Background Color After Clicking the Button in Android?