How to compile forked library in Gradle? How to compile forked library in Gradle? android android

How to compile forked library in Gradle?


This fork isn't published in the maven central repo.

Then you can't use an import like compile com.theDazzler:androidbootstrap:+

You have to:- clone this library locally as a module in your projectClone the https://github.com/theDazzler/Android-Bootstrap/tree/master/AndroidBootstrap folder in your root/module1 folder.

  root:      module1        build.gradle      app        build.gradle      settings.gradle
  • Change your settings.gradle file in

    include ':module1'include ':app'

In your app/build.gradle file you have to add:

dependencies {    // Module Library    compile project(':module1')}

Finally in your module1/build.gradle you have to check the level used for gradle plugin.

EDIT 31/10/2015:

You can use another way to add a dependency with a github project,using the github repo and the jitpack plugin
In this case you have to add this repo tp your build.gradle

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

and the dependency:

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


It can be simply done by using Jitpack.

Step 1. Add the JitPack repository to your build file

allprojects {        repositories {            maven { url 'https://jitpack.io' }        }    }

Step 2. Add the dependency

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

for eg: compile 'com.github.sachinvarma:JcPlayer:0.0.1'


The issue is: has that theDazzler/Android-Bootstrap been published anywhere? In any gradle/maven repo? The usual build.gradle file has a section repositories which should reference that maven repo.

So it is possible any project using theDazzler/Android-Bootstrap should reference the repo where it is published, And with a project like gradle-git-repo-plugin, you could publish that fork on its own release section to publish it.

That task gets wrapped into a publishToGithub task that handles committing and pushing the change. Then you can run

gradle -Porg=layerhq -Prepo=gradle-releases publishToGithub

You can also run

gradle -Porg=layerhq -Prepo=gradle-releases publish

to stage a release in the local github repo and commit it manually.