This is reported a lot in this guide .
How it works?
Gradle imports libraries from the Maven repository. The Maven repository can contain both regular .jar files and regular .aar files.
Where did the library come from?
By default, new versions of Android Studio import from JCenter. JCenter is a Maven repository managed by Bintray.
If you look at the Android Studio build.gradle , you will see the following lines
repositories { jcenter() }
This tells gradle where it should look when trying to import com.squareup.retrofit:retrofit:1.9.0 .
In general terms, how can I publish a library so that other people can import it like that?
You need to create a Bintray account to upload to JCenter, since Bintray owns JCenter. The Bintray site is pretty easy to use compared to what Maven Central, the past Maven repository by default, used by Android Studio.
Once you have created the normal library module inside Android Studio, you will need to configure your build.gradle library module to configure it for Maven. Finally, you use a pre-baked script to load everything into Bintray.
source share