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"
package="com.bestsoftcorporation.circle.app"
android:versionCode="101"
android:versionName="2.0">
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"
}
The easiest way to set the version in Android Studio:
Press SHIFT+CTRL+ALT+S (or File -> Project Structure -> app)
Choose tab 'Flavors'
The last two fields are 'Version Code' and 'Version Name'
You can define your versionName
and versionCode
in your module's build.gradle
file like this :
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
.... //Other Configuration
}
Press Ctrl+Alt+Shift+S in android studio or go to File > Project Structure...
Select app on left side and select falvors tab on right side on default config change version code , name and etc...
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.
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 {
jcenter()
}
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.
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"
}
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.
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.