react-nativereact-native-device-info

React native android app crashes in assemble release build when use react-native-device-info module


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.


Solution

  • 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" />