Original link: github.com/RicardoCao-…

The signature

First, you need to follow the steps of the official documentation to sign the app.

Try to pack

CD Android Go to the Android project directory./ Gradlew assembleRelease start the package

May be stuck in here: app: bundleReleaseJsAndAssets this state has been fixed, direct control + c at this time to give up packaging

React-native bundle –platform android –dev false –entry-file index. Android. Js –bundle-output App/SRC/main/assets/index. The android. The bundle – assets – dest App/SRC/main/res/note:

  1. It needs to be executed in the root directory
  2. If the entry configuration file is not index.android.js, change it to the corresponding entry file name, such as’ index.js’, depending on the version.
  3. The output directory should be in the Android directory to generate the index.android.bundle file. If the directory changes due to the version, it should be changed to the corresponding path

repack

After doing the above steps, we go to the Android project directory and type./ Gradlew assembleRelease -x bundleReleaseJsAndAssets to try to package.

The code has been updated and the APP has not changed?

At this point, we should find that the APP has been successfully packaged, but after installing the APP on the phone, we find that the code has not been updated. This is because each time before packaging, we need to generate a new index.android.bundle file, and then we need to enter the Android project directory. Go to/SRC /main/assets and delete the old index.android.bundle file. Run the react-native bundle –platform android –dev false –entry-file command again Index. Android. Js – bundle – output App/SRC/main/assets/index. The android. The bundle – assets – dest App/SRC/main/res/this step, pack and try again