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

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'


  • 你可以在你的模块的build.gradle文件中定义你的versionNameversionCode ,像这样:

    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.1"
    
        defaultConfig {
            minSdkVersion 8
            targetSdkVersion 19
            versionCode 1
            versionName "1.0"
        }
        .... //Other Configuration
    }
    
    链接地址: http://www.djcxy.com/p/16126.html

    上一篇: GHC TypeLits开销

    下一篇: 如何在Android Studio中更改Android版本和代码版本号?