问题描述
我正在使用React Native v0.19,当在Android上运行时,我的应用程序在Debug上工作得很好,但是当我在Release模式下运行时,或者从签名版本的apk中立即崩溃。 Android Studio会抛出错误:
I'm using React Native v0.19, and when running on Android my app works just fine on Debug, but immediately crashes when I run it in Release mode, or from the signed release apk. Android Studio throws an error:
02-01 13:16:40.650 12399-12424/? E/ReactNativeJS: undefined is not an object (evaluating 's.propTypes.style')
怎么能我解决了这个问题?
How can I fix this?
推荐答案
这是一个错误,因为两个类被转移到React版本v0.19上的另一个包原生: ReactProp
ReactPropGroup
。要解决此错误,请打开 proguard-rules.pro
并编辑以下行:
This is a bug that happens because two classes were moved to another package on version v0.19 of React Native: ReactProp
ReactPropGroup
. To fix this error, open your proguard-rules.pro
and edit the following lines:
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
:
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
参考:
- [Android]Release crash "s.propTypes.style" #5655
这篇关于React Native - Android应用程序在Debug上运行,在Release上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!