Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
167 views
in Technique[技术] by (71.8m points)

android - How to compile forked library in Gradle?

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

https://github.com/theDazzler/Android-Bootstrap

It is forked from https://github.com/Bearded-Hen/Android-Bootstrap, 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 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'
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...