【问题标题】:Importing RoundedImageView from Maven Central从 Maven 中心导入 RoundedImageView
【发布时间】:2014-11-23 08:57:12
【问题描述】:

我从 github 下载了一个项目,该项目没有附带 RoundedImageView 所需的库,该库是项目试图查找的库。我对 Android 有点陌生,并且没有任何使用 build.gradle 文件的经验,根据库的自述文件,该文件需要进行编辑。

有人可以一步一步告诉我如何导入这个库吗?这是我现在所做的: 1.从here下载javadoc.jar文件

  1. 将我的 gradle 文件更改为如下所示:

    buildscript{
        repositories{
            jcenter() //not sure what this is, it was already here
            mavenCentral() //added this
        }
        dependencies{
            classpath 'com.android.tools.build:gradle:0.12.+' //already here
            compile 'com.makeramen:roundedimageview:1.3.0' //added this
        }
    }
    allprojects{
        repositories{
            jcenter() //already here
            mavenCentral() // added this
       }
    }
    

我还创建了一个 libs 文件夹,将 jar 文件放在那里并将其添加到构建路径中……但没有什么能解决我的错误。

【问题讨论】:

    标签: android gradle maven-central bintray jcenter


    【解决方案1】:
    1. 您无需添加mavenCentral()。 JCenter 是 Maven Central 的超集。
    2. 将依赖项添加到 buildScript 使它们可用于构建脚本(因此得名),而不是您尝试构建的项目。
    3. 将依赖项添加到allprojects 闭包(或添加到您需要它的项目中)。
    4. 当然,您不需要手动下载任何内容。这就是依赖管理器的用途。

    buildscript{ repositories{ jcenter() //not sure what this is, it was already here } dependencies{ classpath 'com.android.tools.build:gradle:0.12.+' //already here } } allprojects{ repositories{ jcenter() //already here } dependencies{ compile 'com.makeramen:roundedimageview:1.3.0' //added this } }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-02
      • 1970-01-01
      • 2013-10-30
      • 2011-06-19
      • 2013-10-20
      相关资源
      最近更新 更多