【问题标题】:How to find gradle dependency URL如何找到 gradle 依赖 URL
【发布时间】:2016-04-29 09:36:52
【问题描述】:

例如,这里是 MikePenz MaterialDrawer 库:

compile('com.mikepenz:materialdrawer:4.6.4@aar') {
    transitive = true
}

这是另一个 FancyButtons 库

compile 'com.github.medyo:fancybuttons:1.5@aar'

这些编译行是从哪里来的?我问是因为我刚刚fork了一个项目并做了一点改动,现在我想在我的应用程序中使用这个项目,但我不想下载项目,将模块导入Android Studio,然后从那里去(我没有太多的运气)。如何创建单行 sn-p。

Here's the project I want to compile using this method

【问题讨论】:

    标签: android gradle


    【解决方案1】:

    对于您列出的示例,它们可能来自jCentermavenCentral。你从哪里得到它们取决于你的 build.gradle repositories 部分。你可能有类似的东西:

    repositories {  
     jCenter()  
    }
    

    这基本上是说,当像compile ...这样的行出现在依赖项部分时,去jCenter上查找所需的文件。

    文件最初是如何到达那里的?原始项目的作者将他们的 aar 文件发布到这些存储库。您如何将修改后的库也放在那里?查找发布。 Here is the help page on publishing to jCenter.

    需要注意的是,您不一定必须发布到公共存储库。您甚至可以托管自己的本地存储库,甚至是just publish to a local filesystem folder。无论您发布到哪个 repo,请确保将该 repo 包含在您要从中使用库的另一个项目的 repositories 部分中,并且仅使用 compile ... 行从 repo 中自动获取依赖项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-17
      • 2021-10-08
      • 2015-04-23
      • 1970-01-01
      • 2015-09-16
      • 2016-02-10
      • 2020-03-31
      • 1970-01-01
      相关资源
      最近更新 更多