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

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

问题描述

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

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

我正在根据此URL生成文件 https://facebook.github.io/react-native/docs/signed-apk-android.html

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

我曾尝试修改AndroidManifest.xml文件,但是在构建它之后,该文件会自动被修改回去.

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" >

在这里,我修改了XML:

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.

推荐答案

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

android {

    defaultConfig {

        versionCode 1
        versionName "1.0"

        {...}
    }

    {...}
}

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

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