如何在离子框架中更改应用程序版本?

Ali*_*eer 10 ionic-framework

如何在Ionic框架中更改版本代码并确保它被Play商店接受?

Play商店不允许上传生成的apk,版本号为1000.

Sab*_*ari 21

在config.xml中

<widget android-packageName="com.package.app.android" android-versionCode="1000" id="com.package.app" version="1.0" xmlns="w3.org/ns/widgets"; xmlns:cdv="cordova.apache.org/ns/1.0">
Run Code Online (Sandbox Code Playgroud)

  • 对于 android,您必须编辑 build.gradle 文件,该文件将在项目内的 android 文件夹中可用。在 build.gradle 文件中,您必须更改 versionCode 和 versionName (2认同)

Dhe*_*raj 6

在config.xml中更改这些行.每次构建一个.希望这会有所帮助

<!-- Android -->
<widget id="io.cordova.hellocordova" version="0.0.1" android-versionCode="13" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>

<!-- iOS -->
<widget id="io.cordova.hellocordova" version="0.0.1" ios-CFBundleVersion="0.1.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
</widget>
Run Code Online (Sandbox Code Playgroud)


Ana*_*aja 6

For the android, you have to edit your build.gradle file which will be available inside android folder inside your project.

In build.gradle file, you have to change versionCode and versionName

see the example code below

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.companyname.appname"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)


Ref*_*Jan 5

对于离子 4,没有android-versionCode场。因此,您应该更改config.xml 文件中的versioninwidget字段(通常为第 2 行)。

例如:

<widget id="myapp.mycompany.com" version="0.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
Run Code Online (Sandbox Code Playgroud)

在这种情况下,只需将版本从 0.0.3 更改为 0.0.4 或您想要的任何数字。