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

产生情景:导入第三方lib作为Module时会报错,导致导入失败

产生原因:原项目的compileSdkVersion或buildToolsVersion与该lib不一致


解决方案:在根目录设置同意的版本号


打开该项目的根目录的build.gradle,

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

则添加

ext { 
compileSdkVersion = 23 
}

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

则添加

	ext {
   	 buildToolsVersion = "25.0.2"
	}

	其他的类似

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
回答: 这个错误是由于在build.gradle文件中缺少相应的属性导致的。根据引用\[1\]和引用\[2\]的建议,你需要在extra properties extension中添加buildToolsVersioncompileSdkVersion属性。具体的解决方法是在build.gradle文件中添加以下代码: ``` android { // 添加buildToolsVersion属性 buildToolsVersion "版本号" // 添加compileSdkVersion属性 compileSdkVersion 版本号 } ``` 此外,根据引用\[3\]的建议,你还需要在dependencies块中添加相应的依赖项。具体的解决方法是在build.gradle文件中的dependencies块中添加以下代码: ``` dependencies { implementation fileTree(dir: 'libs', include: \['*.jar'\]) implementation rootProject.ext.dependencies.appcompat implementation rootProject.ext.dependencies.constraintlayout testImplementation rootProject.ext.testDependencies.junit androidTestImplementation rootProject.ext.testDependencies.runner androidTestImplementation rootProject.ext.testDependencies.espresso_core } ``` 通过以上的修改,你应该能够解决这个错误。 #### 引用[.reference_title] - *1* *2* [Cannot get property 'compileSdkVersion' on extra properties extension as it does not exist问题解决](https://blog.csdn.net/u013768203/article/details/53140449)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [ERROR: Cannot get property 'dependencies' on extra properties extension as it does not exist](https://blog.csdn.net/weixin_40420578/article/details/102934754)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值