0

Just rebuilt React Native app as the previous version failed in building on Android emulator. The React Native is upgraded from 0.66 to 0.67 and a few other modules, such as React Native gesture handler, were upgraded as well.

The app works fine on Android 2021.1.1 Patch 2 emulator. However after downloading the release package from the distribution server, the app installed on Android 10 device quits as soon as launching without giving any error.

What is the problem with the release package? Here is the build steps:

  1. ./gradlew bundleRelease
  2. bundletool build-apks to build mypackage.apks with signature.
  3. unzip it into mypackage.apk

Connecting android device to dev Mac using USB cable, the app was launched successfully on the real device. And the app can be launched successfully late as well. I notice that the size of the app is 77MB which is about twice as big as the app installed from the universal apk.

3
  • Some update. I managed to setup React Native publish in android and generated a universal apk. After installation of the apk on android phone, the app crashes the same way. The app was given storage permission on the android phone. I suspect the crash may be permission related. Commented Apr 8, 2022 at 20:09
  • Have you try to build app with release mode on mac? (BuildFlavor => change to Release), some module only crash in release mode. Or you can install the app that crash from store and plug USB into laptop and see what's error on the log Commented Apr 9, 2022 at 16:06
  • You can use Crashlytics in order to identify where the app crashes !! Commented Apr 9, 2022 at 16:28

1 Answer 1

2

If you need to check apk on real device, follow this build steps:

Release APK Generation.

Place your terminal directory to Android using:

cd android

Then run the following command:

For Windows:

gradlew assembleRelease

For Linux and Mac OSX:

./gradlew assembleRelease

As a result, the APK creation process is done. You can find the generated APK at android/app/build/outputs/apk/app-release.apk. This is the actual app, which you can send to your phone or upload to the Google Play Store. Congratulations, you’ve just generated a React Native Release Build APK for Android.

There are frequent errors that show up in this process sometimes, which is typical to a React Native app, given React Native is continuously evolving. We are laying out here the most frequent React Native build errors that we ran into, to save you time and headaches.

Sign up to request clarification or add additional context in comments.

9 Comments

There is no issue generating the valid apk package for publish.
u are using gradlew bundleRelease
now please try gradlew assembleRelease
I can't use apk without signature. Here is article about assembleRelease vs bundleRelease and bundleRelease is google's preferred according to the article. stackoverflow.com/questions/57072558/…
Some update. I managed to setup React Native publish in android and generated a universal apk. After installation of the apk on android phone, the app crashes the same way. The app was given storage permission on the android phone. I suspect the crash may be permission related.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.