gradle android的依赖配置dependencies

来源:互联网 发布:阿里云域名过户怎么过 编辑:程序博客网 时间:2024/06/08 09:25
/** * 配置仓库 */repositories{    //本地扁平目录仓库    flatDir{        dir('libs')    }    jcenter()}/** * 自定义dependencies过滤组 * 因为dependencies只支持基本的风味分组 比如free x86 arm等 不支持组合 * 这样定义后就支持组合了 */configurations{    freeArmDebugCompile{}}/** *  调用./gradlew :app:dependencies 查看依赖的情况 * * compile 编译(classpatch)+打包apk * apk 仅打包 不参与编译 * provided 只编译 不打包 */dependencies {    freeArmDebugCompile 'pub.devrel:easypermissions:0.1.9'    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {        exclude group: 'com.android.support', module: 'support-annotations'    })    compile 'com.android.support:appcompat-v7:25.3.1'    testCompile 'junit:junit:4.12'    //引进目录下的所有.jar文件    compile fileTree(include: ['*.jar'], dir: 'libs')    //引进指定的jar包 目录相对于build.gradle//    compile files('libs/a.jar','libs/b.jar')    //导入myLibrary库 并指定配置为release 配和下面补充的第二条  ,    compile project(path:':mylibrary',configuration:'release')    //下面是多种写法 出现重复的时候会自动选择最新的依赖,排除重复依赖    compile 'com.android.support.constraint:constraint-layout:1.0.2'    //另外一种写法    compile group:'com.android.support.constraint',name: 'constraint-layout',version: '1.0.2'    //使用1开头的最高版本    compile group: 'com.android.support.constraint',name: 'constraint-layout',version: '1.+'    //使用最新版本    compile group: 'com.android.support.constraint',name:'constraint-layout',version:'latest.integration'    compile 'com.android.support:appcompat-v7:25.3.1'    compile 'com.facebook.fresco:fresco:0.14.0',{        //关闭fresco传递的一些依赖 这样会把所有的传递依赖都关闭//        transitive false        //关闭指定的传递依赖 可以解决依赖冲突        exclude(group:'com.android.support',module:'support-core-utils')    }    //配置本地扁平仓库support-test-aa.arr 前提必须配置repositories    //不建议这么配置 容易缺少依赖 最好配置远程仓库 远程仓库含有pom文件 可以指定依赖//    compile name:'support-test-aa',ext:'aar'}
阅读全文
0 0
原创粉丝点击