react-native: [Android]Release crash "s.propTypes.style"

02-01 13:16:40.650 12399-12424/? E/ReactNativeJS: undefined is not an object (evaluating 's.propTypes.style')
02-01 13:16:40.670 12399-12425/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
                                                   Process: com.reading, PID: 12399
                                                   com.facebook.react.modules.core.JavascriptException: <unknown>
                                                       index.android.bundle:18:31918
                                                   r
                                                       index.android.bundle:1:575
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       index.android.bundle:18:16832
                                                   r
                                                       index.android.bundle:1:575
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       index.android.bundle:18:15861
                                                   r
                                                       index.android.bundle:1:575
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       index.android.bundle:18:14713
                                                   r
                                                       index.android.bundle:1:575
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       index.android.bundle:18:13643
                                                   r
                                                       index.android.bundle:1:575
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       index.android.bundle:17:26122
                                                   r
                                                       index.android.bundle:1:575
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       index.android.bundle:1:11742
                                                   r
                                                       index.android.bundle:1:575
                                                   r
                                                       index.android.bundle:1:304
                                                   n
                                                       index.android.bundle:1:241
                                                   <unknown>
                                                       global code@index.android.bundle:19:25326
02-01 13:16:40.730 12399-12424/? E/ReactNativeJS: Module AppRegistry is not a registered callable module.

I found s.propTypes.style in index.android.bundle here:

g=o.createClass({displayName:"ScrollableTabView",statics:{DefaultTabBar:f},propTypes:{tabBarPosition:d.oneOf(["top","bottom"]),initialPage:d.number,page:d.number,onChangeTab:d.func,onScroll:d.func,renderTabBar:d.any,style:s.propTypes.style}

but debug is right, release crash. why?

react-native version: 0.19.0 used: react-native-scrollable-tab-view

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hey Richard-Cao, thanks for reporting this issue!

React Native, as you’ve probably heard, is getting really popular and truth is we’re getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don’t know how to do something or something is not working as you expect but not sure it’s a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you’re using. Thank you for your contributions!

it is very strange,my App crashes on release build in RN 0.49, debug release works fine. i check proguard-rules.pro file lin 45-46:

-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } -keep class * extends com.facebook.react.bridge.NativeModule { *; } -keepclassmembers,includedescriptorclasses class * { native <methods>; } -keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; } -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; } -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }

I found the problem, ReactProp and ReactPropGroup were moved to the annotations package and the proguard file was not updated accordingly.

To fix it you can change

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

in your proguard-rules.pro line 45-46

I’ll submit a PR to fix the templates.

I had the same problem, it ended up being an outdated module I was including.

https://github.com/d-a-n/react-native-modal-picker

I switched to an updated fork, and it worked

https://github.com/peacechen/react-native-modal-selector

@kristjanmik I was able to get past that error by adding the following proguard rule: -keep class com.facebook.** { *; }

You can refer to this StackOverflow question for more info.