Easy to upgrade your react-native app

Usage no npm install needed!

<script type="module">
  import reactNativeEasyUpgrade from '';



Easy to upgrade your react-native app

Getting started

$ npm install react-native-easy-upgrade --save

Mostly automatic installation

$ react-native link react-native-easy-upgrade

Manual installation


  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-easy-upgrade and add RNEasyUpgrade.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNEasyUpgrade.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<


  1. Open up android/app/src/main/java/[...]/
  • Add import org.hstar.reactnative.easyupgrade.RNEasyUpgradePackage; to the imports at the top of the file
  • Add new RNEasyUpgradePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
include ':react-native-easy-upgrade'
project(':react-native-easy-upgrade').projectDir = new File(rootProject.projectDir,   '../node_modules/react-native-easy-upgrade/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
  compile project(':react-native-easy-upgrade')

2019-5-11 Note:

由于android7.0+提供了file provider权限控制,如果android7.0+机型需在主项目中使用file provider,否则将没有权限访问文件!详见demo AndroidManifest.xml及res/xml/provider_paths.xml.


import RNEasyUpgrade from 'react-native-easy-upgrade';

this.easyUpgrade = new RNEasyUpgrade({
  iOSAppId: '12345678',
  downloadTitle: 'Download package',
  downloadDescription: 'Packing downloading...',
  downloadApkEnd: () => {
   //eg: install apk
  onError: () => {

async getUpdateInfo() {
  let updateInfo = {
    latestVersion: '3.0.0',
    hasNewVersion: true,
    apkUrl: 'http://{remoteApkDownloadUrl}'
  if (isAndroid) {
    updateInfo = await fetch('http://{remoteUrl}/updateInfo.json')
  } else {
    updateInfo = await this.easyUpgrade.checkAppVersionIOS()
  return updateInfo;

 async startUpgrade() {
    const updateInfo = await this.getUpdateInfo();
    if (updateInfo.hasNewVersion) {
        'Find a new version: ' + updateInfo.latestVersion,
        'Whether to upgrade app?',
          {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
          {text: 'Upgrade', onPress: () => this.easyUpgrade.startAppUpdate(updateInfo.apkUrl)},