0
votes

I am trying to import a project in my Android Studio 1.5.1. I firstly removed one error of 'com.android.application' not found but then this error has been risen. enter image description here

Gradle sync failed: Could not find property 'VERSION_CODE' on ProductFlavor_Decorated{name=main, dimension=null, minSdkVersion=DefaultApiVersion{mApiLevel=14, mCodename='null'}, targetSdkVersion=DefaultApiVersion{mApiLevel=23, mCodename='null'}, renderscriptTargetApi=null, renderscriptSupportModeEnabled=null, renderscriptNdkModeEnabled=null, versionCode=null, versionName=null, applicationId=com.fractalwrench.androidbootstrap.sample, testApplicationId=null, testInstrumentationRunner=null, testInstrumentationRunnerArguments={}, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}}.

1
How did you define the VERSION_CODE variable?Gabriele Mariotti

1 Answers

3
votes

The problem is with the VERSION_CODE and VERSION_NAME. I guess they are missing in your project. You can hardcode the version code and version name like this -

versionCode 21
versionName "1.0"

or can make it dynamic like this -

def versionMajor = 1
def versionMinor = 1
def versionBuild = 0
defaultConfig {
  versionCode versionMajor * 1000000 + versionMinor * 10000 + versionBuild * 100
  versionName "${versionMajor}.${versionMinor}.${versionBuild}"
}