Android_Importing library from GitHub - smukov/AvI GitHub Wiki

Importing 3rd Party Library to Android Studio

Today I had to start working on my Profile Screen, and the first requirement I had was the Circular Image View for my Profile Image. I started searching the web and I found quite a few available solutions (libraries) out there. After some reading I decided to go with Henning Dodenhof's awesome library called CircularImageView that he hosted on GitHub.

So now that I found the library that I needed, I had to figure out how to actually import it to my project. I was expecting some complicated process which includes downloading from GitHub, creating a folder in my project and pasting the library code, then including the references in my project, etc... I couldn't have been more wrong.

All you need to do to import the 3rd party library to your Android Studio project is to add a single compile line inside the dependencies section in your build.gradle file (the one in the app folder), and that's it, gradle does the rest.

dependencies {
    ...
    compile 'de.hdodenhof:circleimageview:2.0.0'
}

And now I can use the CircularImageView library inside my project like this:

<de.hdodenhof.circleimageview.CircleImageView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/profile_image"
    android:layout_width="96dp"
    android:layout_height="96dp"
    android:src="@drawable/profile"
    app:civ_border_width="2dp"
    app:civ_border_color="#FF000000"/>