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
66 0
|
6月前
|
Java 数据库 Spring
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
87 0
|
6月前
|
Java 数据库连接 Spring
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could
这个错误通常出现在使用Spring Boot进行数据库连接时。错误信息表明Spring Boot未能配置一个DataSource,因为没有指定'url'属性,并且没有发现默认的数据库连接。
357 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!
106 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”?
141 1
|
Oracle Java 关系型数据库
Error setting null for parameter #6 with JdbcType OTHER . Try setting a different JdbcType for this
Error setting null for parameter #6 with JdbcType OTHER . Try setting a different JdbcType for this
565 0
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”?
|
数据库
Failed to configure a DataSource: url attribute is not specified and no embedded datasource could...
Failed to configure a DataSource: url attribute is not specified and no embedded datasource could...
Failed to configure a DataSource: url attribute is not specified and no embedded datasource could...
|
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
984 0
No valid Maven installation found. Either set the home directory in the configuration dialog or set