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.

user938363
  • 9,990
  • 38
  • 137
  • 303
  • 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. – user938363 Apr 08 '22 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 – Tran Quan Apr 09 '22 at 16:06
  • You can use Crashlytics in order to identify where the app crashes !! – Jagroop Apr 09 '22 at 16:28

1 Answers1

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.

halfer
  • 19,824
  • 17
  • 99
  • 186
Vijay
  • 275
  • 2
  • 11
  • There is no issue generating the valid apk package for publish. – user938363 Apr 06 '22 at 16:24
  • u are using gradlew bundleRelease – Vijay Apr 06 '22 at 16:40
  • now please try gradlew assembleRelease – Vijay Apr 06 '22 at 16:40
  • I can't use apk without signature. Here is article about assembleRelease vs bundleRelease and bundleRelease is google's preferred according to the article. https://stackoverflow.com/questions/57072558/whats-the-difference-between-gradlewassemblerelease-gradlewinstallrelease-and – user938363 Apr 06 '22 at 23:26
  • 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. – user938363 Apr 08 '22 at 20:08
  • Are u bind the metro server to our apk ? – Vijay Apr 10 '22 at 04:06
  • yesh is right but my release apk is run my device but not run any other device where is my problem ? –  Jan 04 '23 at 04:15
  • Please share more details @GattuPatel – Vijay Jan 06 '23 at 05:58
  • this problem is soul can you give me answer this question @Vijay https://stackoverflow.com/questions/75027501/phone-book-design-not-proper-in-react-native –  Jan 06 '23 at 06:08