Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native App Debug mode works fine, Release mode crashes (App Registry and evaluating 'a.View.propTypes.style')

I've been implementing map box recently, and I've updated to the latest version of react-native, gradle, and what not. The app runs absolutely fine in debug mode, but as soon as I run it in release mode it crashes immeidately with no warning screen at all. I'm using the new propTypes, and so on.

Please see the output log

Okay I apologise, whilst the above works in debug mode, the app is now crashing when building a release and I'm confused.

I'm attempting to build a release, and the crashes immediately although works fine in debug mode:

11-23 00:48:14.499: E/SDAgentPackageStateReceiver(6040): Not going to handle 'com.goclustr.clustr'!
11-23 00:48:14.704: E/CS/CscParser(20341): mps_code.dat does not exist
11-23 00:48:14.720: E/CS/CscParser(20341): mps_code.dat does not exist
11-23 00:48:14.735: E/CS/CscParser(20341): mps_code.dat does not exist
11-23 00:48:14.884: E/Launcher.Model(1564): onPackageAdded :com.goclustr.clustr
11-23 00:48:14.906: E/ApplicationPackageManager(1564): checkSettingsForIconTray value : 0
11-23 00:48:14.907: E/ApplicationPackageManager(1564): checkSettingsForIconTray value : 0
11-23 00:48:15.589: E/ReflectField(20468): Incorrect type : Fallback exception
11-23 00:48:15.589: E/ReflectField(20468): Incorrect type : Fallback exception
11-23 00:48:15.778: E/SemAffinityControl(20435): SemAffinityControl: registerfunction enter
11-23 00:48:16.281: E/SensorService(6040): getSensorList a sensor (MAX86902) without holding its required permission: com.samsung.permission.SSENSOR
11-23 00:48:16.281: E/SensorService(6040): getSensorList a sensor (HRM Ambient Light Canceling) without holding its required permission: com.samsung.permission.HRM_EXT
11-23 00:48:16.281: E/SensorService(6040): getSensorList a sensor (HRM Proximity detecting) without holding its required permission: com.samsung.permission.HRM_EXT
11-23 00:48:16.281: E/SensorService(6040): getSensorList a sensor (HRM Sensor) without holding its required permission: com.samsung.permission.SSENSOR
11-23 00:48:16.281: E/SensorService(6040): getSensorList a sensor (Sensor Diagnostic Monitor) without holding its required permission: com.samsung.permission.SSENSOR
11-23 00:48:16.297: E/Finsky(311): [1] com.google.android.finsky.wear.bk.a(3): onConnectionFailed: ConnectionResult{statusCode=API_UNAVAILABLE, resolution=null, message=null}
11-23 00:48:16.633: E/AndroidRuntime(20526): Process: com.goclustr.clustr, PID: 20526
11-23 00:48:16.633: E/AndroidRuntime(20526): com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'a.View.propTypes.style'), stack:
11-23 00:48:16.633: E/AndroidRuntime(20526): global code@841:9
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:56)
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:40)
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:374)
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
11-23 00:48:16.633: E/AndroidRuntime(20526):    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
11-23 00:48:16.850: E/ApplicationPackageManager(6833): checkSettingsForIconTray value : 0
11-23 00:48:16.850: E/ApplicationPackageManager(6833): checkSettingsForIconTray value : 0
11-23 00:48:16.865: E/ApplicationPackageManager(6833): checkSettingsForIconTray value : 0
11-23 00:48:17.259: E/ReactNativeJS(20526): Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)
11-23 00:48:18.615: E/SMTCodec(20807): Fail to load libsmtcodec.so
11-23 00:48:18.616: E/SMTCodec(20807): [VoiceCodec] Can use only PCM mode. 
11-23 00:48:19.302: E/HealthDataStore(20878): disconnectService: Context instance is invalid
11-23 00:48:20.297: E/HealthDataStore(20903): disconnectService: Context instance is invalid
11-23 00:48:20.588: E/com.strava.util.Benchmark(20998): "com.strava.StravaApplication.total" took 285 ms, but expected 60-175 ms
11-23 00:48:21.328: E/ActivityThread(20789): Failed to find provider info for com.samsung.accessory.saproviders.sasvoice.util.SASVoiceNativeAppProvider
11-23 00:48:21.486: E/HealthDataStore(20878): disconnectService: Context instance is invalid
11-23 00:48:27.157: E/svoiceapi(20789): in pds_open function, Caught RCF::Exception: Unable to establish network connection.
11-23 00:48:27.158: E/svoiceapi(20789): KEY : rampcode, VALUE : dash
11-23 00:48:27.158: E/svoiceapi(20789): KEY : reason, VALUE : Unable to establish network connection
11-23 00:48:45.574: E/CS/CscParser(21190): mps_code.dat does not exist
11-23 00:48:45.588: E/CS/CscParser(21190): mps_code.dat does not exist
11-23 00:48:45.602: E/CS/CscParser(21190): mps_code.dat does not exist
11-23 00:48:46.291: E/SensorService(6040): getSensorList a sensor (MAX86902) without holding its required permission: com.samsung.permission.SSENSOR
11-23 00:48:46.291: E/SensorService(6040): getSensorList a sensor (HRM Ambient Light Canceling) without holding its required permission: com.samsung.permission.HRM_EXT

As you can see there is an error for

11-23 00:48:17.259: E/ReactNativeJS(20526): Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)

and

com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 'a.View.propTypes.style'), stack:

None of which are a problem in debug mode

Thanks very much!

like image 613
Michael Avatar asked Nov 23 '17 00:11

Michael


1 Answers

Using react-codemon, run on your projects directory

jscodeshift -t react-codemod/transforms/React-PropTypes-to-prop-types.js myapp/

This will resolve updating proptypes for your source code and any node modules.

Re-installing node modules will require running the command again it seems.

Please follow instructions over at https://github.com/reactjs/react-codemod but essentially once you've installed jscodeshift, and you've downloaded the react-codemod files as above for the various commands such as transforming React.propTypes to PropTypes and so on.

myapp/ here corresponds to my entire application project directory so the entire react-native project.

Secondly, consider the project dependencies you're using. For example in my case I was using react-native-router-flux at version 0.38.0, the app would work in debug mode, but crash in release. I attempted to upgrade to the latest beta version of 4.0.0-beta.24 and the problem was resolved.

like image 105
Michael Avatar answered Oct 15 '22 02:10

Michael