How to make your library in Github importable to Android studio


I know that you can import Github libraries in android studios using Gradle:

compile 'com.github.someone.something:xxx-yyy:+'

What is that part: <strong>xxx-yyy:+</strong> ? How do I build the project so that it can be imported with the previous line?

So far if I just upload a library and import it without that last xxx-yyy:+, I get an error that it is an invalid description. If I write a version then I get an error saying that it can't be found


This is all handled via Maven by way of Gradle's Maven Plugin.

It's apparent that you've already grasped that someone is the Github user and something is their fork of the repo.

Here's the documentation for Maven dependency (it was easier to find and it is the same as compile)

<a href="http://maven.apache.org/plugins/maven-compiler-plugin/dependency-info.html" rel="nofollow">http://maven.apache.org/plugins/maven-compiler-plugin/dependency-info.html</a>

The xxx-yyy is the artifactId. Maven artifact IDs must match this regex: [A-Za-z0-9_\-.]+. Note that the artifact ID doesn't even need the dash. It could just be "library".

Finally the last bit is the version (I believe this is the tag in Github). + indicates you want the latest, but you could specify a specific version.


To achieve it, you have to publish your library on Maven.

It requires some gradle knowledge. Here you can find some useful links.

<strong>EDIT 30/10/2015:</strong>

To achieve it you have some ways:

<ol><li>publish your library (artifact) in central maven or jcenter.</li> <li>use a github repo and the <a href="https://jitpack.io/" rel="nofollow"><strong>jitpack</strong> plugin</a></li> </ol>

<strong>The point 2.</strong> is very simple. Just push your codein github and modify the gradle script in the project where you want to use it.

Just add this repo tp your build.gradle

repositories { // ... maven { url "https://jitpack.io" } }

and the dependency:

dependencies { compile 'com.github.User:Repo:Tag' }

<strong>To publish</strong> a library in Central Maven or JCenter, it is very long to explain in an answer. Hovewer you can read these posts:


Publish on <a href="http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en" rel="nofollow">JCenter</a>

</li> <li>

Publish on <a href="http://gmariotti.blogspot.it/2013/09/publish-aar-file-to-maven-central-with.html" rel="nofollow">Central Maven</a>. Another blog for <a href="http://chris.banes.me/2013/08/27/pushing-aars-to-maven-central/" rel="nofollow">Central Maven</a>

</li> </ul>


  • Expand the functionality of wpf
  • EGit and multiple “users” on same machine
  • Why do I need to force git to sync my remote repository?
  • LibGit2Sharp CheckoutPaths()
  • Maven release with jenkins slave and Credentials : how to pass SCM credentials to maven?
  • sequel trying to use postgresql instead of postgres as adapters
  • Different version of file in Mercurial repo
  • Describe the .NET assembly circular dependency problem in layman's terms
  • lein uberjar doesn't pack the jar file under resource into the final jar
  • No internet connectivity inside docker container running inside kubernetes with weave as networking
  • Google Cloud Builder - Gradle
  • JENKINS: ERROR when I try to use an older JDK for a specific maven project
  • Referencing external dependencies in GGTS by convention
  • force insert with spring data jpa
  • Google cloud datastore emulator init data
  • Exception handling as per java coding standards
  • “git push” doing the same as “git fetch” from the remote
  • Regarding client side code generation from WSDL
  • Whats the right place for testhelper-classes? (phpunit/best practise)
  • How to force Composer to download a local package?
  • maven jboss-as:start A required class was missing … org/sonaty…/ArtifactResolutionException
  • SQL query to group by maximal sets of a column having inner consecutive distances below a threshold
  • How do you create a Fuseki SPARQL server using the Apache Jena Java API?
  • Iron Router: How do I send data to the layout?
  • How to generate and display a QR Code in ionic 2
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Calling Worksheet functions from vba in foreign language versions of Excel
  • Control modification in presentation layer
  • Java applet as stand-alone Windows application?
  • Jquery - Jquery Wysiwyg return html as a string
  • bootstrap to use multiple ng-app
  • How to get icons for entities from eclipse?
  • SQL merge duplicate rows and join values that are different
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • JaxB to read class hierarchy
  • Is there any way to bind data to data.frame by some index?
  • Reading document lines to the user (python)
  • How can i traverse a binary tree from right to left in java?