title: Set Android app version using Gradle
body: <p>I'm trying to use Gradle to set app's name. Please, look at this snippet of build.gradle:</p>
  
  <pre><code>android {
      ...
      defaultConfig {
          ...
          versionCode getVersionCode()
          versionName getVersionName()
          ...
      }
      ...
  }
  
  ...
  
  int getVersionCode() {
      return 1
  }
  
  def getVersionName() {
      return "1.0"
  }
  </code></pre>
  
  <p>Android Studio says</p>
  
  <pre><code>   'versionCode' cannot be applied to 'java.lang.Integer'
     'versionName' cannot be applied to 'java.lang.String'
  </code></pre>
  
  <p>and when I install the app on a device it has no versionCode and versionName at all.</p>
  
  <p>The problem is clear to me but I don't know how to solve it.<br>
  Please advice.</p>