如何在 Gradle 中编译分叉库? [英] How to compile forked library in Gradle?

查看:31
本文介绍了如何在 Gradle 中编译分叉库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在build.gradle的项目中编译以下库:

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

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

它是从 https://github.com/Bearded-Hen/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.

我尝试过这样的事情:

compile 'com.theDazzler:androidbootstrap:+'

但 gradle 失败并显示未找到库的错误.

but gradle failed and shows error that library not found.

任何人都可以分叉和/或发布它吗?

Can anyone fork it and/or publish it?

推荐答案

此 fork 未在 maven 中央存储库中发布.

然后你不能使用compile com.theDazzler:androidbootstrap:+

你必须:- 在本地将这个库克隆为项目中的一个模块克隆https://github.com/theDazzler/Android-Bootstrap/tree/master/AndroidBootstrap 文件夹在您的 root/module1 文件夹中.

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

      包含':module1'包括':app'

      include ':module1' include ':app'

      在您的 app/build.gradle 文件中,您必须添加:

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

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

      最后在你的 module1/build.gradle 中,你必须检查用于 gradle 插件的级别.

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

      编辑 31/10/2015:

      您可以使用另一种方式为 github 项目添加依赖项,使用 github repo 和 jitpack 插件
      在这种情况下,您必须将此 repo 添加到您的 build.gradle

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

      和依赖:

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

      这篇关于如何在 Gradle 中编译分叉库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆