1

In debug build it is working fine but when in release apk build, when run it only display splash screen then it crashes.

I tried many technics and look the related issue in the forum to fix it, did not work.

Raikumar Khangembam
  • 948
  • 1
  • 12
  • 24

2 Answers2

2

Solution:

I was not able to track how the released apk app crashing. It worked fine in debug mode.

The simple trick that I made work.

when I run this command in projectname/android and open release apk app

adb logcat *:E

It gives me this error exception in logcat

04-20 12:31:49.153 23368 23410 E AndroidRuntime: java.lang.SecurityException: WifiService: Neither user 11740 nor current process has android.permission.ACCESS_WIFI_STATE.

04-20 12:31:49.153 23368 23410 E AndroidRuntime:        at android.os.Parcel.createException(Parcel.java:2088)

04-20 12:31:49.153 23368 23410 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:2056)

04-20 12:31:49.153 23368 23410 E AndroidRuntime:        at android.os.Parcel.readException(Parcel.java:2004)

04-20 12:31:49.153 23368 23410 E AndroidRuntime:        at android.net.wifi.IWifiManager$Stub$Proxy.getConnectionInfo(IWifiManager.java:3474)
...

There was no wifi access permission which is required by react-native-device-info module.

In the Manifest file, I give this permission and work it out.

<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Raikumar Khangembam
  • 948
  • 1
  • 12
  • 24
  • when I try this adb logcat *:E it's give me more then your error which one you post abov –  Jan 04 '23 at 04:10
0

Another nice way to track the bug in release build is as follow

Connect your device with Metro. Run this command

npx react-native log-android

After that run the following command

npx react-native run-android --variant=release

Your logs will appear in Metro console.

Sanaullah Javeid
  • 103
  • 1
  • 10