Android Studio 和 Gradle
由于以前没做过什么java项目,在使用Android Studio时遇到了Gradle,真是一头雾水,决定总结一下。
具体的使用方法请参看:http://www.cnblogs.com/youxilua/p/3348162.html
--------------------------------------------------------------------------------------------------------------------------------
什么是构建工具?其实就是build工具,在软件开发中用来将源代码和其他输入文件转换为可执行文件的形式(也有可能转换为可安装的产品映像形式)。随着应用程序的生成过程变得更加复杂,确保在每次生成期间都使用精确相同的生成步骤,同时实现尽可能多的自动化,以便及时产生一致的生成版本。类似Unix/Linux C程序员经常使用的Make工具,但是提供了许多新功能,来弥补Makefiles的不足。
看看以下来自http://www.oschina.net/question/558461_117208的解释
一般而言.一个比较正规的项目都不会基于IDE 进行构建..一般会用ant, maven, gradle ,
为什么不用ide 呢?首先,是ide的选择,有人喜欢,用vim,eclipse,intellijidea,收费的,免费的. 特别是公开的项目,你用什么IDE 相当于为这个IDE 打广告了.. 所以,一般而言都是用构建工具,而不是IDE .实际上各种IDE 也是基于各种构建系统,也正是不同的IDE,它们的构建方式不同,所以要让不同的IDE间能一起开发,于是需要一个统一的构建工具,只是你平时不关注而已.. 扯到构建工具, 一般c/c++ 项目用make,或者 premake. 而java 一般是ant,ivy,gradle,maven,还有直接的shell, 是不是很多没听说过呢?
这里没有提到xcode使用的构建工具,我想它应该使用了一套自己的构建方法,也算一种IDE自带的构建。
来看一下Android Studio中的Gradle截图,

其实,就是一系列的build步奏。
--------------------------------------------------------------------------------------------------------------------------------
1. 在Android开发中常用的构建工具
There are two types of Android projects that work in Android Studio:
- Gradle-based projects. These are created by default.
- IntelliJ "classic" projects. These cannot be created in Studio, but when they are created in IntelliJ, they can be opened in Studio.
In Android Studio, we are focusing all of our efforts on the Gradle-based projects, both in terms of feature development and in testing. If you are using Studio, we strongly recommend you use Gradle-based projects. If you prefer IntelliJ projects, you might want to use IntelliJ: The Android support in Studio, including the gradle support, is also all available in IntelliJ.
简单的说,用Studio创建出的全是使用gradle构建工具的工程,而使用IntelliJ IDEA 这个IDE,可以创建IntelliJ "classic" projects。这种"classic" projects的构建工具是什么?
- Support for binary libraries (AARs). You no longer need to copy library sources (such as ActionBarSherlock) into your own projects, you can simply declare a dependency and the library is automatically downloaded and merged into your project. This includes automatically merging in resources, manifest entries, proguard exclusion rules, custom lint rules etc at build time.
- Support for variants and build types. This makes it trivial to for example offer different versions of your app such as a free version and a "pro" version.
- Easy build configuration and customization. For example, you can pull version names and version codes from git tags as part of the build.
- Gradle can be used from the IDE but also from the command line and from CI servers like Jenkins, providing the same build everywhere, every time.
2.在Android Studio中使用Gradle
请参见官方文档 Gradle Plugin User Guide
Android Studio 和 Gradle的更多相关文章
- Android studio下gradle Robolectric单元测试配置
android studio下gradle Robolectric单元测试配置 1.Robolectric Robolectric是一个基于junit之上的单元测试框架.它并不依赖于Android提供 ...
- android studio 使用gradle 导出jar包,并打包assets目录
警告:本文年久失修. 随着android studio的升级 ,gradle的升级,严格按照本文的代码去做可能不会成功,希望依然可以作为解决问题的思路. 最近项目在做一个sdk,供别的开发者使用,所以 ...
- Android Studio :Android Studio 与 Gradle 深入【二】
转载:http://www.apkbus.com/forum.php?mod=viewthread&tid=255063&extra=page%3D2%26filter%3Dautho ...
- [转]--android studio 使用gradle 导出jar包,并打包assets目录
转自: http://www.cnblogs.com/wuya/p/android-studio-gradle-export-jar-assets.html 最近项目在做一个sdk,供别的开发者使 ...
- Android 项目利用 Android Studio 和 Gradle 打包多版本APK
在项目开发过程中,经常会有需要打包不同版本的 APK 的需求. 比如 debug版,release版,dev版等等. 有时候不同的版本中使用到的不同的服务端api域名也不相同. 比如 debug_ap ...
- 利用 Android Studio 和 Gradle 打包多版本APK
在项目开发过程中,经常会有需要打包不同版本的 APK 的需求. 比如 debug版,release版,dev版等等. 有时候不同的版本中使用到的不同的服务端api域名也不相同. 比如 debug_ap ...
- 快速掌握 Android Studio 中 Gradle 的使用方法
快速掌握 Android Studio 中 Gradle 的使用方法 Gradle是可以用于Android开发的新一代的 Build System, 也是 Android Studio默认的build ...
- Android studio的gradle
1. gradle的基本概念 gradle构建* Android Studio使用`Gradle`构建工具,Eclipse的ADT插件使用的是`Ant`构建工具* 构建:生成app的过程,执行一些的命 ...
- Android Studio 解决 Gradle 依赖冲突的问题
Android Studio 解决 Gradle 依赖冲突的问题 参考链接: Android Studio(Gradle)解决库依赖冲突问题:http://www.mobibrw.com/2016/3 ...
- android studio 更新 Gradle错误解决方法(Gradle sync failed)
android studio 更新 Gradle错误解决方法 Android Studio每次更新版本都会更新Gradle这个插件,但由于长城的问题每次更新都是失败,又是停止在Refreshing ...
随机推荐
- 设计模式原来如此-代理模式(Proxy Pattern)
代理模式(Proxy Pattern)是一个使用率非常高的模式,其定义如下:为其他对象提供一种代理以控制对这个对象的访问. 在某些情况下,一个客户不想或者不能直接引用另一个对象,而代理对象可以在客户端 ...
- 【bzoj1005】 HNOI2008—明明的烦恼
http://www.lydsy.com/JudgeOnline/problem.php?id=1005 (题目链接) 题意 给出标号为1到N的点,以及某些点最终的度数,允许在任意两点间连线,可产生多 ...
- jQuery插件开发教程
jQuery插件开发教程 ——让你的jQuery水平提升一个台阶 要说jQuery 最成功的地方,我认为是它的可扩展性吸引了众多开发者为其开发插件,从而建立起了一个生态系统.这好比大公司们争相做平台 ...
- tomcat8编码
web工程,本机能跑的代码放到生产环境中后能跑但是得不到预期的结果,十有八九的原因是 编码问题
- java 小记
1.获取web项目根目录的绝对路径 request.getContextPath() 获取项目名称,如 /BiYeSheJi getServletContext().getRealPath(& ...
- TCPCopy 应用
TCPCopy 使用方法 TCPCopy是一种请求复制(所有基于tcp的packets)工具,可以把在线请求导入到测试系统中去.目前此工具已经广泛应用于国内各大互联网公司. TCPCopy七大功能1) ...
- Change ICON of MFC Application and Dialog
Change ICON of MFC Application and Dialoghttp://www.codeproject.com/Tips/406870/Change-ICON-of-MFC-A ...
- ICMP Internet控制报文协议
ICMP是(Internet Control Message Protocol)Internet控制报文协议.它是TCP/IP协议族的一个子协议,用于在IP主机.路由器之间传递控制消息.控制消息是指网 ...
- Vimer的福音 新时代的Vim C++自动补全插件 clang_complete
使用vim的各位肯定尝试过各种各样的自动补全插件,比如说大名鼎鼎的 OmniCppComplete .这一类的插件都是对 Ctags 生成的符号表进行字符串匹配来获得可能的补全项.他们在编写 C 代码 ...
- Ajax技术详解
Ajax技术:Ajax描述了一种主要使用脚本(JS)操纵HTTP的web应用架构,它的主要特点是使用脚本操纵HTTP和web服务器进行数据交换,不会导致页面重载.Ajax的核心是JS的XMLHttpR ...