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

相关文章
|
7月前
|
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
113 0
|
7月前
|
Java 数据库连接 Spring
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could
这个错误通常出现在使用Spring Boot进行数据库连接时。错误信息表明Spring Boot未能配置一个DataSource,因为没有指定'url'属性,并且没有发现默认的数据库连接。
405 0
|
缓存 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!
118 0
|
7月前
|
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”?
179 1
|
Java 数据库连接 mybatis
mybatis报错:Type handler was null on parameter mapping or property ‘__frch_xxx_0’
mybatis报错:Type handler was null on parameter mapping or property ‘__frch_xxx_0’
2128 0
mybatis报错:Type handler was null on parameter mapping or property ‘__frch_xxx_0’
|
7月前
|
前端开发
【前端】解决: Property 'inline' does not exist on type 'ClassAttributes<HTMLElement> & HTMLAttribut...
【前端】解决: Property 'inline' does not exist on type 'ClassAttributes<HTMLElement> & HTMLAttribut...
180 0
使用pageHelper报错 Type definition error: [simple type, classXXXX]
使用pageHelper报错 Type definition error: [simple type, classXXXX]
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
|
数据库
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...