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完成配置

相关文章
|
6月前
|
Kubernetes 容器
error: no configuration has been provided, try setting KUBERNET
error: no configuration has been provided, try setting KUBERNET
64 0
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
|
缓存 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!
102 0
|
6月前
|
数据库
Field ‘xxx‘ doesn‘t have a default value
Field ‘xxx‘ doesn‘t have a default value
49 0
|
6月前
|
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”?
129 1
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
|
Java Maven
No valid Maven installation found. Either set the home directory in the configuration dialog or set
No valid Maven installation found. Either set the home directory in the configuration dialog or set
963 0
No valid Maven installation found. Either set the home directory in the configuration dialog or set
No plugin found for prefix ‘doclint‘ in the current project
No plugin found for prefix ‘doclint‘ in the current project
130 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
128 0