Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist问题解决

Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist问题解决

情景:当在 导入 外项目的 lib 库中遇到了 这个问题,

原因: 
这个问题表示 项目中的多个项目的 compileSdkVersion 都不一致.

解决办法: 
如果有很多项目,可以设置全局来统一管理版本号或依赖库,

根目录下build.gradle下: 
ext { 
compileSdkVersion = 23 
buildToolsVersion = “23.0.2” 
minSdkVersion = 14 
targetSdkVersion = 23 
}

这里写图片描述

报Cannot get property ‘compileSdkVersion’ on extra properties extension as it does not exist ,加compileSdkVersion

报Cannot get property ‘buildToolsVersion’ on extra properties extension as it does not exist ,加buildToolsVersion

就这么简单 :-D