gradle构建依赖

gradle 作为构建工具,能够很方便的使用本地jar包,以下为使用的代码块。

 1 dependencies {
 2     //单文件依赖
 3     compile files('libs/android-support-v4.jar')
 4     //某个文件夹下面全部依赖
 5     compile fileTree(dir: 'libs', include: '*.jar')
 6 }
 7 
 8 android {
 9     
10 }

gradle 同时支持maven,ivy,由于ivy我没用过,所以用maven 作为例子,以下为代码块:

repositories {
    //从中央库里面获取依赖
    mavenCentral()
    //或者使用指定的本地maven 库
    maven{
        url "file://F:/githubrepo/releases"
    }
    //或者使用指定的远程maven库
    maven{
        url "https://github.com/youxiachai/youxiachai-mvn-repo/raw/master/releases"
    }
}

dependencies {
    //应用格式: packageName:artifactId:version
    compile 'com.google.android:support-v4:r13'
}

android {

}

 

posted @ 2015-10-31 17:27  Tcool  阅读(420)  评论(0编辑  收藏  举报