Gradle DSL method not found when updating application version

I want to update my application in the Google Play Store, it cannot accept an updated file with the same version.

I changed the version from the build.gradle file:

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
    applicationId "net.koorasudan.app"
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 5.1
    versionName "5.1"
}
buildTypes {
    release {
           minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

But when I synchronize gradle, it shows me this error:

Error: (23, 0) gradle DSL method not found: 'versionCode ()' Possible reasons:

The SmartView 3 project may use a version of gradle that does not contain a method. Open the gradle shell file. The gradle plugin may not be in the build file. Apply gradle plugin

How to solve this problem?

+4
source share
4 answers

versionCode is an integer.

You cannot use versionCode 5.1in yourbuild.gradle

script.

apply plugin: 'com.android.application'
+10

android gradle?

apply plugin: 'android'

! 5.1 5, !

+3

You must put your version code in Integer. after any publication of your application, you need to increase the version code so that the Android OS detects that this version is newer.

but in the version name you can put whatever you want in string format.

hope useful

+1
source

FWIW: I ran into this problem when testing for large version codes (> = 10 digits). Gradle bug?

+1
source

All Articles