Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - Android app working on Debug, crashing on Release

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?

like image 484
heitortsergent Avatar asked Feb 16 '16 01:02

heitortsergent


People also ask

How do I run React Native apps in debug mode?

You can also use the ⌘D keyboard shortcut when your app is running in the iOS Simulator, or ⌘M when running in an Android emulator on macOS and Ctrl+M on Windows and Linux. Alternatively for Android, you can run the command adb shell input keyevent 82 to open the dev menu (82 being the Menu key code).

How do I fix an APK crash?

Clear App Data and Cache. It will help you delete the unnecessary app data that causes the crash: Go to Settings > Apps/Application manager > Choose the apps that crash frequently > Tap Clear data and Clear cache option.


1 Answers

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>; }

for:

-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }

Reference:

  • [Android]Release crash "s.propTypes.style" #5655
like image 123
heitortsergent Avatar answered Oct 17 '22 01:10

heitortsergent