update - how to change version code of apk in android studio

How to change android version and code version number in Android Studio? (6)

After updating the manifest file, instead of building your project, go to command line and reach the path ...bld\Debug\platforms\android. Run the command "ant release". Your new release.apk file will have a new version code.

How to change android version and code version number Android Studio? I want to change apk file(app) on Google Play and i need to change android version and code version number. I tried with this in AndroidManifest.xml file in Android Studio:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

But it wont work. When i tried to publish it on Google Play it display that i must to change android version name and code. Pls help.

Go in the build.gradle and set the version code and name inside the defaultConfig element

defaultConfig {
    minSdkVersion 9
    targetSdkVersion 19
    versionCode 1
    versionName "1.0"

I didn't get the other answers to work in Android Studio 1.4. But this worked: click on your app name to the left below the main ribbon. It will show a list of files. Open AndroidManifest.xml and change the version code and version number there.

Open your build.gradle file and make sure you have versionCode and versionName inside defaultConfig element. If not, add them. Refer to this link for more details.

The easiest way to set the version in Android Studio:

  1. Press SHIFT+CTRL+ALT+S (or File -> Project Structure -> app)

  2. Choose tab 'Flavors'

  3. The last two fields are 'Version Code' and 'Version Name'

You can manage your application versioning wisely by using the Advanced Build Version Plugin for Gradle.

You just need to include the plugin in yout build.gradle:

buildscript {
  repositories {

  dependencies {
      classpath 'org.moallemi.gradle.advanced-build-version:gradle-plugin:1.5.0'

apply plugin: 'org.moallemi.advanced-build-version'

And then you can use the versioning functions (and, obviously, customize them):

advancedVersioning {
    nameOptions { }
    codeOptions { }
    outputOptions { }

def appVersionName = advancedVersioning.versionName
def appVersionCode = advancedVersioning.versionCode

For more information, take a look at the official documentation.