Android gradle: buildtoolsVersion vs compileSdkVersion

首先来一段从stackoverflow上看到的英文解释
compileSdkVersion is the API version of Android that you compile against.

buildToolsVersion is the version of the compilers (aapt, dx, renderscript compiler, etc…) that you want to use. For each API level (starting with 18), there is a matching .0.0 version.

At IO 2014, we release API 20 and build-tools 20.0.0 to go with it.

Between Android releases we will release updates of the compilers, and so we’ll release version .0.1, .0.2, etc… Because we don’t want to silently update these version under you, it’s up to you to move to the new version when it’s convenient for you.

You can use a higher version of the build-tools than your compileSdkVersion, in order to pick up new/better compiler while not changing what you build your app against.

大致意思就是说compileSdkVersion 是你要进行编译时对应的android Api的版本号,而buildToolsVersion 是进行编译时编译器的版本号,并且编译器的版本号可以高于Api的版本号以获取更优化的编译后的文件,也就是说buildToolsVersion >compileSdkVersion 是可以的

同时从Api版本18开始,每个版本都对应有一个.0.0的buildToolsVersion 版本号,也就是compileSdkVersion 为18时,对应的buildToolsVersion 肯定有18.0.0

而且,在Eclipse和Ant中我们不指定buildToolsVersion版本时,IDE会帮我们自动选择最新的来带入,而Android Studio则要我们手动设置

最后想要详细了解compileSdkVersion, buildToolsVersion, minSdkVersion and targetSdkVersion的关系可以查看下面这个网站https://medium.com/google-developers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd#.2m2uy5ugy

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值