根据https://developer.android.com/tools/revisions/build-tools.html,该版本添加了对Android 6.0(包含新的requestPermission方法)的支持。build.gradle文件中的buildToolsVersion究竟有什么作用?
Revision 23.0.0 (August 2015)
Added support
for the Android 6.0 (API level 23) release.
我使用新requestPermission方法为Android 6.0,但没有更新buildToolsVersion - 但程序仍然有效,当我想到的构建过程失败(见所附图片)。
所以问题是:buildToolsVersion究竟做了什么?我想知道22.0.1版为什么不应该这样工作? android studio是否绕过了build.gradle文件中的值?的build.gradle
import groovy.swing.SwingBuilder
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
compileOptions {
encoding "UTF-8"
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
//Minimum FROYO
minSdkVersion 4
targetSdkVersion 23
<snip off unrelated parts>
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:support-v4:23.0.1'
// ads: google play
googlePlayCompile 'com.android.support:appcompat-v7:23.0.1'
googlePlayCompile 'com.google.android.gms:play-services-ads:7.5.0'
testCompile 'org.robolectric:robolectric:2.4'
testCompile 'junit:junit:4.12'
}
编辑 的
相关章节中the other question回答说,我必须使用buildToolsVersion> = compileSdkVersion使用的新功能。然而,我正在使用这些新功能,而无需更新buildToolsVersion。
http://stackoverflow.com/questions/24521017/android-gradle-buildtoolsversion-vs-compilesdkversion –
@Amiya:这是在那里我得到难倒...“您可以使用更高版本的编译工具比你的compileSdkVersion,为了选择新的/更好的编译器,而不改变你的应用程序构建你的应用程序。“我的buildTool版本低于compileSdkVersion(并且我正在使用compileSdkVersion中的新功能,这些功能不应该存在于较早的buildTool中) –