Gradle DSL method not found when updating application version

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'

Did you add the android plugin on top of the gradle file?

apply plugin: 'android'

Version code needs to be an integer by the way! switch from 5.1 to 5 and it will work!


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