How to compile forked library in Gradle?

前端 未结 4 1060
你的背包
你的背包 2020-12-05 00:35

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

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

It is forked from https:/

相关标签:
4条回答
  • 2020-12-05 01:00

    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'

    0 讨论(0)
  • 2020-12-05 01:03

    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'
        }
    
    0 讨论(0)
  • 2020-12-05 01:18

    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.

    0 讨论(0)
  • 2020-12-05 01:18

    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:

     root
       YourProject
          settings.gradle
          YourProjectModule
              build.gradle
    
       AndroidBootStrap
          AndroidBootStrapLibrary
              build.gradle
    

    In the end the files look like this:

    settings.gradle:

    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

    0 讨论(0)
提交回复
热议问题