如何更新本机应用程序的版本号 [英] How to update version number of react native app

查看:61
本文介绍了如何更新本机应用程序的版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android 上使用 React Native.如何在应用程序中更新版本号?当我收到此错误时.

我正在按照这个 url 生成文件

解决方案

您应该更改 android/app/build.gradle 中的 versionCodeversionName:

android {默认配置{版本代码 1版本名称1.0"{...}}{...}}

请注意,versionCode 必须是一个大于先前版本所用整数的整数,而 versionName 是可能向用户显示的人类可读版本.

I am using React native with Android. How can I update version number in the app? As I am getting this error.

I am generating file as per this url https://facebook.github.io/react-native/docs/signed-apk-android.html

I have tried modifying AndroidManifest.xml file, but after I build it, that file gets automatically modified back.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.facebook.react"
    android:versionCode="1"
    android:versionName="1.0" >

Here, I modified the XML:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.facebook.react"
    android:versionCode="2"
    android:versionName="1.1" >

After, build file automatically changes back.

解决方案

You should be changing your versionCode and versionName in android/app/build.gradle:

android {

    defaultConfig {

        versionCode 1
        versionName "1.0"
        
        {...}
    }

    {...}
}

Note that versionCode has to be in an integer that is larger than the ones used for previous releases while versionName is the human readable version that may be shown to users.

这篇关于如何更新本机应用程序的版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆