Android Studio Gradle Dependencies
2016-04-11 17:28
477 查看
Android Studio Gradle Dependencies
一、依赖配置
1. 远程库依赖(Library Dependency)
指定远程仓: repositories { mavenCentral() } 配置编译依赖: compile 'com.package.name:project_name:version' 如:compile 'com.xxx.xxx:project_name:1.3.1'
2. 文件依赖
指定后缀方式: compile fileTree(dir: "libs', include: ['*.jar', "*.xxx"]) 指定jar路径方式: compile files('../mylibs/xxx.jar') aar文件依赖: 依赖目录与文件 repositories { flatDir{ dirs 'libs' } } compile(name:'aar_file_name',ext:'aar')
3. 项目依赖
Android Studio的aar文件可以打包资源,不建议使用这种依赖。 compile project(':AnotherModule')
二、依赖类型
1. Compile
会将依赖编译并打包到最终的apk文件中。
2. Provider
依赖只参与编译,不会打包到apk中。
3. APK
依赖仅打包到apk中,不参与编译。
4. Test compile
依赖仅会在编译单元测试代码时被编译并打包到最终apk中。
5. Debug compile
依赖仅会在编译Debug版本时被编译并打包到最终apk中。
6. Release compile
依赖仅会在编译Release版本时被编译并打包到最终apk中。
参考链接:
http://www.94cto.com/index/Article/content/id/75315.htmlhttp://www.cnblogs.com/kangyi/p/4449857.html
相关文章推荐
- SourceProvider.getJniDirectories
- 执行失败的任务 ': processDebugManifest'
- Android Studio使用教程(六):Gradle多渠道打包
- Android客户端程序Gradle如何打包
- Android Studio注释模板介绍
- Android Studio使用教程(四):Gradle基础
- Android Studio使用教程(五):Gradle命令详解和导入第三方包
- Win7安装gradle
- mac gradle 安装
- 关于Android Studio 和 Gradle的那些事儿
- Gradle这个黑盒子
- 收藏各种技术源码
- maven用户试用gradle
- 用Gradle 构建你的android程序
- 用Gradle 构建你的android程序-依赖管理篇
- Gradle 构建 android 应用常见问题解决指南
- Adnroid Studio Gradle 多渠道打包
- Gradle,构建工具的未来?
- Android Studio 使用 Gradle 打包 Jar-IT蓝豹
- Install Android Studio in Ubuntu 16.04 LTS