How to compile forked library in Gradle?

android git github gradle android-studio

5865 просмотра

4 ответа

641 Репутация автора

I want to compile the following library in my project in build.gradle:

It is forked from, but no documentation in the repository explains how to include in in project.

I tried something like this:

compile 'com.theDazzler:androidbootstrap:+'

but gradle failed and shows error that library not found.

Edit: Can anyone fork it and/or publish it?

Автор: Fenil Источник Размещён: 12.01.2015 08:22

Ответы (4)

3 плюса

905729 Репутация автора

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.

Автор: VonC Размещён: 14.02.2015 09:27

37 плюса

123398 Репутация автора


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 project Clone the folder in your root/module1 folder.

  • 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 "" }

and the dependency:

dependencies {
        compile 'com.github.User:Repo:Tag'
Автор: Gabriele Mariotti Размещён: 15.02.2015 08:07

3 плюса

106 Репутация автора

Hi i had the same issue but with a different project :)

So first you should have the library code on your dev machine. Next steps are: add a new file called settings.gradle to the root of your project if its not already there.

inside add this:

include 'AndroidBootStrap'
project('AndroidBootStrap').path = "path/to/AndroidBootstrap/AndroidBootStrapLibrary"

also add include for your root project if its not there. Inside your build.gradle file add

compile project(':AndroidBootStrap')

to add the dependency.

How your folder Structure should look:



In the end the files look like this:


include 'AndroidBootStrap'
project('AndroidBootStrap').path = "../AndroidBootstrap/AndroidBootStrapLibrary"
include 'YourProjectModule'

build.gradle (YourModule):

dependencies {
   compile project(':AndroidBootStrap')

Maybe its necessary to modify some point but i hope you get the idea!

Cheers Neri

Автор: Dominik Размещён: 16.02.2015 11:16

6 плюса

1316 Репутация автора

It can be simply done by using Jitpack.

Step 1. Add the JitPack repository to your build file

allprojects {
        repositories {

            maven { url '' }

Step 2. Add the dependency

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

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

Автор: Sachin Varma Размещён: 26.06.2017 06:07
Вопросы из категории :