Cannot get property 'versionCode' on extra properties extension as it does not exist

简介: Cannot get property 'versionCode' on extra properties extension as it does not exist

有时候我们在网上下载三方库后,导入到AS中,会提示以上错误。

点击open file,AS会自动定位到产生错误的位置.

这是因为引入的三方库的build.gradle中会根据我们项目build.gradle的ext{}中定义的数据进行配置。如果我们项目中没有定义,就会出现这个错误。

解决方法

打开项目的build.gradle。

新建一个ext{},在里面定义三方库需要引用的变量。

ext{
    compileSdkVersion = 23
    buildToolsVersion = "22.0.1"
    targetSdkVersion = 23
    versionCode = 1
    versionName = "1.0"
}


然后点击try again,等待gradle完成配置

相关文章
Field userMapper in zero.file.videoProject.service.UserService required a bean of type ‘zero.file.vi
Field userMapper in zero.file.videoProject.service.UserService required a bean of type ‘zero.file.vi
|
12月前
|
缓存 Java 数据库连接
MybatisPlusException: Your property named “xxx“ cannot find the corresponding database column name!
MybatisPlusException: Your property named “xxx“ cannot find the corresponding database column name!
92 0
|
5月前
|
数据库
Field ‘xxx‘ doesn‘t have a default value
Field ‘xxx‘ doesn‘t have a default value
36 0
|
5月前
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
96 1
|
Java Apache Spring
解决required a single bean, but 2 were found问题
背景:springboot整合shiro中自定义Realm时出现 错误描述 Parameter 0 of method getDefaultWebSecurityManager in cn.ken.springboot_shiro.config.ShiroConfig required a single bean, but 2 were foun
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
|
Java API Spring
A component required a bean named xxx that could not be found
A component required a bean named xxx that could not be found
A component required a bean named xxx that could not be found
No plugin found for prefix ‘doclint‘ in the current project
No plugin found for prefix ‘doclint‘ in the current project
122 0
The 'manifest_version' key must be present and set to 2 (without quotes)
The 'manifest_version' key must be present and set to 2 (without quotes)
78 0
|
Java
The type XXX cannot be resolved. It is indirectly referenced from required .class files
The type XXX cannot be resolved. It is indirectly referenced from required .class files
117 0