- compileSdkVersion、buildToolsVers
- Gradle for Android -- 几个常见的变量
- compileSdkVersion, minSdkVersion
- compileSdkVersion, targetSdkVers
- compileSdkVersion、minSdkVersion、
- Android studio buildToolsVers
- Android的xxxxSdkVersion及gradle简单解
- error: resource android:attr/fon
- buildToolsVersion、compileSdkVers
- 【android】Android 7.0适配步骤
这是我在上一篇文章中的图片。前面说过这里要对应,这一步很重要。这是最理想的情况。都对应上是最好的。

compileSdkVersion 所在项目使用的sdk库版本
buildToolsVersion 构建工具的版本
buildToolsVersion 目标设备的sdk版本
com.android.support:appcompat-v7:26.+ 声明支持的sdk库版本。
如果compileSdkVersion 与 buildToolsVersion 不匹配会出现如下问题。可能buildToolsVersion 版本低了一个可以编译,但是不建议这样操作。匹配成一致的是最好的。

targetSdkVersion 版本低一些是没有问题的。因为sdk库是向下兼容的。在你的设备上用了sdk以前的一些接口,你说会出问题吗?
com.android.support:appcompat-v7:26.+这个声明很重要。如果版本低了,可能低了一个版本却可以编译,这说明是你没用到高级版增加的内容,但是AS会提示你这样是不好的,应该设置成一致的。

并且如果你支持的版本过高,而实际你要用到低版本的sdk库,也会识别不到的低版本库里面的内容的!!!!如图

网友评论