Create your first android library
An Android library is like JAR files, the Android ARchive(AAR) bundle is the binary distribution of an Android Library Project.
Apart from JAR file, AAR contain resources as well as compiled byte-code and assets are not supported. we can make library modules which can be used as dependencies in Android projects.
Start writing here...
1.Getting started
In Android Studio each library is a module. To create a new library module in an existing Android project.
select File ▸ New ▸ New Module and select Android Library.
After successful build please ensure library is added to your existing project dependencies.
api project(:'yourlibraryname')
2.Create classes & resources for the library
I have created a library named infinityscroll which is used for pagination in RecyclerView. infinityscroll consist of two classes, both are accessible to the main app module
3.Share the project in GitHub.
Upload the created project to GitHub and create a release for your library.
add version tag & title then click publish release.
4.Publishing the library
The final step go to jitpack.io and sign in with your GitHub account. You see the GitHub repositories on the left side choose it from there or you can type/paste the project GitHub url in the textfield.
Finally
Finally you’ll get the dependency of published library like this
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ajithvgiri:recyclerview-pagination:v1.0'
}