I am a newbie with Android Studio. I am trying to use this project library : https://github.com/2dxgujun/AndroidTagGroup in my project.
So what I did is to import it as a module in my project ; with the name "androidtaggroup"
Now, I have got the following error at compilation:
"Could not get unknown property 'VERSION_NAME' for project ':androidtaggroup' of type org.gradle.api.Project."
Here is where the problem occurs in the Gradle file:
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
minSdkVersion 8
targetSdkVersion 21
versionName project.VERSION_NAME // ERROR HERE !!!!
versionCode Integer.parseInt(project.VERSION_CODE)
}
Anybody can tell me how to fix this problem ?
Thanks !!!
The fix is to define your version name there or use a custom made variable. project.VERSION_NAME
does not exists by default, therefore you can't use it. That is basically what the error message is telling you.
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
minSdkVersion 8
targetSdkVersion 21
versionName "1.2.3"
versionCode Integer.parseInt(project.VERSION_CODE)
}
or alternative:
// somewhere above
def VERSION_NAME = "1.2.3"
// and the usage:
defaultConfig {
applicationId 'me.gujun.android.taggroup.demo'
minSdkVersion 8
targetSdkVersion 21
versionName VERSION_NAME
versionCode Integer.parseInt(project.VERSION_CODE)
}
And after you have changed that you will probably run into the same issue for using project.VERSION_CODE
:
versionCode Integer.parseInt(project.VERSION_CODE)
Fix is the same: provide a valid self defined variable or constant
buildscript {
ext.kotlin_version = '1.3.31'
ext.room_version = '2.1.0-alpha01' // Add this line in your build gradle
repositories {
google()
jcenter()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With