Perform the following steps to create the library:
Create a GitHub account.
Create a Git repository containing your library project.
Modify your library project's build.gradle file by adding the following code:
apply plugin: 'com.github.dcendents.android-maven'
...
// Build a jar with source files.
task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}
task javadoc(type: Javadoc) {
    failOnError  false
    source = android.sourceSets.main.java.sourceFiles
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    classpath += configurations.compile
}
// Build a jar with javadoc.
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}
artifacts {
    archives sourcesJar
    archives javadocJar
}
Make sure that you commit/push the above changes to GitHub.
Create a release from the current code on Github.
Run gradlew install on your code.
Your library is now available by the following dependency:
compile 'com.github.[YourUser]:[github repository name]:[release tag]'