Gradle配置dependencies
来源:互联网 发布:2017亚吉铁路现状知乎 编辑:程序博客网 时间:2024/06/16 19:55
转自:http://blog.csdn.net/honjane/article/details/52575803
dependencies { compile fileTree(dir: 'libs', includes: ['*.jar']) compile project(':honjane-demo-library') betaCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' betaCompile 'com.github.moduth:blockcanary-ui:1.1.4' apt 'com.jakewharton:butterknife-compiler:8.1.1' }
依赖规则:
例如 betaCompile ‘com.github.moduth:blockcanary-ui:1.1.4’
betaCompile group: 'com.github.moduth', name: 'blockcanary-ui', version: '1.1.4'
依赖方式有如下几种
Compile
compile是对所有的build type以及favlors都会参与编译并且打包到最终的apk文件中。
Provided
Provided是对所有的build type以及favlors只在编译时使用,类似eclipse中的external-libs,只参与编译,不打包到最终apk。
APK
只会打包到apk文件中,而不参与编译,所以不能再代码中直接调用jar中的类或方法,否则在编译时会报错
下面3种与buildTypes对应的几种依赖
Test compile
Test compile 仅仅是针对单元测试代码的编译编译以及最终打包测试apk时有效,而对正常的debug或者release apk包不起作用。
Debug compile
Debug compile 仅仅针对debug模式的编译和最终的debug apk打包。
Release compile
Release compile 仅仅针对Release 模式的编译和最终的Release apk打包。
依赖本地文件:
compile fileTree
compile fileTree(dir: 'libs', include: '*.jar') provided fileTree(dir: '../honjane-demo-library/libs', include: '*.jar') compile(name: 'lib-1.1', ext: 'aar')//依赖并执行本地aar包
依赖远程文件:
compile "com.jakewharton:butterknife:8.2.1" provided 'com.android.support:support-annotations:23.2.1'
依赖库工程(多module):
compile project(':honjane-demo-library')
阅读全文
0 0
- Gradle配置dependencies
- Gradle配置dependencies
- gradle android的依赖配置dependencies
- android gradle dependencies
- Gradle之dependencies
- Android Studio Gradle Dependencies
- Gradle Dependencies Helper插件
- gradle --refresh-dependencies cleanEclipse eclipse
- android studio gradle dependencies 包存放在哪儿?
- gradle Illegal entry in Gradle Dependencies d:/eclipse
- Gradle配置
- gradle 配置
- gradle配置
- Gradle配置
- gradle配置
- Gradle配置
- Gradle配置
- Gradle配置
- angular2回调函数与数据绑定不能实时更新的问题
- Android使用SharedPreferences来缓存数据
- java使用HttpGet下载文件
- 杂谈 关于写程序的一点朴素的原理
- 关于Python中以字母r/R,或字母u/U 开头的字符串
- Gradle配置dependencies
- JVM GC的各种问题
- osql -E登录报错:设置SQL Server不允许远程连接这个事实可能会导致失败
- struct regmap *syscon;初始化
- poj 2631 树的直径裸题 注意设置n
- 基于Node.JS索引mp3 ID3 tag信息并存储入MySQL数据库
- windows dubbo-admin本地编译打包
- FLV文件格式——实例分析
- 如何判断单链表是否有环、环的入口、环的长度和总长