React Native App Debug模式工作正常,发布模式崩溃(App Registry并评估' a.View.propTypes.style')

时间:2017-11-23 00:59:18

标签: gradle react-native android-gradle react-native-android

我最近一直在实施地图框,我已经更新到最新版本的react-native,gradle,以及什么不是。该应用程序在调试模式下运行绝对正常,但只要我在发布模式下运行它就会立即崩溃,完全没有警告屏幕。我正在使用新的propTypes,依此类推。

请参阅输出日志

好的,我道歉,虽然以上工作在调试模式下,应用程序现在在构建版本时崩溃,我很困惑。

我试图构建一个版本,但是在调试模式下工作正常但崩溃了:

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

正如您所看到的,

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

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

调试模式中没有任何问题

非常感谢!

1 个答案:

答案 0 :(得分:3)

使用react-codemon,在项目目录中运行

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

这将解决更新源代码和任何节点模块的proptypes。

重新安装节点模块将需要再次运行命令。

请按照https://github.com/reactjs/react-codemod上的说明进行操作,但基本上已经安装了jscodeshift,并且您已经按照上面的react-codemod文件下载了各种命令,例如将React.propTypes转换为PropTypes等等。

myapp/对应于我的整个应用程序项目目录,因此整个react-native项目。

其次,考虑您正在使用的项目依赖关系。例如,在我的情况下,我在版本react-native-router-flux使用0.38.0,该应用程序将在调试模式下运行,但在发布时崩溃。我尝试升级到4.0.0-beta.24的最新测试版,问题已解决。