Warm tip: This article is reproduced from stackoverflow.com, please click
android-gradle-plugin build.gradle google-play gradle updates

Gradle DSL method not found when updating application version

发布于 2020-05-04 01:50:59

I want to update my app on google play store, it can't accept the updated file with the same version.

Do I've changed the version from 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 sync the gradle it shows me this error :

Error:(23, 0) Gradle DSL method not found: 'versionCode()' Possible causes:

  • The project 'SmartView 3' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file
  • The build file may be missing a Gradle plugin. Apply Gradle plugin
  • How to solve this problem?

    Questioner
    KingoC
    Viewed
    141
    Gabriele Mariotti 2015-07-03 05:06

    The versionCode is an integer.

    You can't use versionCode 5.1 in your build.gradle

    Also you have to add this line at the beginning of your script.

    apply plugin: 'com.android.application'