2016-04-21 14 views
0

Android Studio 1.5.1でプロジェクトをインポートしようとしています。私は最初に 'com.android.application'のエラーを1つ削除しましたが、このエラーは発生しました。 enter image description hereプロパティ 'VERSION_CODE'が見つかりませんでした。エラー:(21,0)

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={}}.

+0

どのようにVERSION_CODE変数を定義しましたか? –

答えて

1

問題がVERSION_CODEとVERSION_NAMEです。私は彼らがあなたのプロジェクトに欠けていると思います。あなたはこのようにバージョンコードとバージョン名をハードコーディングすることができます -

versionCode 21 
versionName "1.0" 

またはこのような、それを動的にすることができます -

def versionMajor = 1 
def versionMinor = 1 
def versionBuild = 0 
defaultConfig { 
    versionCode versionMajor * 1000000 + versionMinor * 10000 + versionBuild * 100 
    versionName "${versionMajor}.${versionMinor}.${versionBuild}" 
} 
関連する問題