How to Add Support for Android Libraries

In your Android Studio project explorer, you will find two files named 'build.gradle'. One covers the entire project while the second covers the current module. In Android Studio 3.5, the project explorer appears as shown below:








The module 'build.gradle' file has a section that looks like the figure below.


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'    testImplementation 'junit:junit:4.12'    androidTestImplementation 'androidx.test.ext:junit:1.1.0'    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'    implementation 'com.android.support:recyclerview-v7:28.0.0'
 
To add a new support library, go to https://developer.android.com/topic/libraries/support-library/packages
Browse the list of support libraries/packages and copy the appropriate link. For example, to add support for RecyclerView, the link is: com.android.support:recyclerview-v7:28.0.0



Add this to the build.gradle file as:

implementation 'com.android.support:recyclerview-v7:28.0.0'

Note that a new set of libraries, AndroidX, is the latest.  You can not get a version greater 
than 28.0.0 for the older libraries. After 28, you need to switch to AndroidX. 
Have a look at this:
https://www.youtube.com/watch?v=0FZ_eUIsLTg
 


 

Comments

Popular posts from this blog

How to Avoid Death by Gradle - painless Android Studio configuration

Gradled to Death