-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' #17530
Comments
Facing Same Issue. |
Same here RN@0.49.0
|
Same Issue |
Same issue. Same logtrace |
Same here on RN 44.0 |
+1 anotha' one |
Guys restarting the packager and clearing cache worked for me! |
Same issue for me. I am using RN 0.51.0 and react-native-material-textfield 0.12.0. |
I am facing this issues as well. The strange thing is that it is very hard to track the error as the stack trace does not contain any useful information. I even do not know what where the error could be. |
Same error happening on RN 0.52.0. |
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version? I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer. |
Same issue on 0.53.3 |
Same issue |
@react-native-bot Need to reopen issue |
facing the same issue with Android 8 |
Same here. React native 0.53.3, SM-T550, API Level 25 (Android 7.0) |
this issue just popped up with me, React native 0.53.3 - Android 8.1. |
React native 0.53.3, android 8, same issue |
Same issue, react-native 0.53.0 and android 8. It strange cause this error seems to appears randomly. I can't find any exact steps to reproduce it. |
Why is this issue closed? Some of us are facing this issue in production environment, so "restarting the packager" is not an acceptable solution. |
This issue needs to be reopened since it affects current version. |
I am also facing stack traces that might be related:
@grabbou can we re-open this issue? |
Same issue here android 8.0 api 26 |
Same on 0.54.2. I've narrowed it down to a |
Please reproduce with the latest version available now and I will reopen this. |
Guys, what fixes the problem is not the React Native version update, but a change in native styles, which can be viewed here: https://react-native-community.github.io/upgrade-helper/?from=0.66.0&to=0.67.4
So, if you update your RN version, but not apply these new styles, the problem will not go away. |
Thanks but a lot of people mentioned above:
This error still happens sometimes. It happens less frequently than before, but still happening. |
hello @namnm i have just ran into this same problem, the updates from RN upgrade helper + update RN version wont work, i am even thinking about implementing my own TextInput JS version to avoid rendering RNTextInput directly, do you think this is reliable? i am having some issues on styling RNTextInput but for a quick test i was able to shut down the crash |
hey guys i have been able to cut off this crash on JS side, do you think it is reliable? i am on RN 0.62 |
@rafaelnco does it still appear when you use the testing component from #17530 (comment) above? |
hey @glenn-axsy sorry for the delay! im really sorry i havent had the time to test it using the testing component youve mentioned.. |
Please avoid opacity to textinputs. It may help you avoid this crash. But If it's necessary for you guys to use opacity then give opacity to view and make it as a wrapper for textinput. |
thanks @douglasjunior it works |
@hrishi2430 This crash occurs even with the style change. Just less often. |
Error still exits |
Why is this closed, it's still an issue on production builds even on RN 0.70.3 |
Still getting this issue in 0.70.5 |
same issue |
Guys some clear way forward.... am getting lost |
I was getting the same error. The bug was because an external library - react-native-google-places-autocomplete (v2.5.1) Implementation -> I had a Modal that allowed user to input address for places-autocomplete. Tap on "input" should open keyboard. But, because of wrong implementation the keyboard was not opening (hence the drawable method unavailable). The solution was to fix JS code -> adding "keyboardShouldPersistTaps" worked. I am assuming that some of you might be facing similar issue. I hope this helps |
Add the flowing line of code into /android/app/src/main/res/values/styles.xml
Hope this will work. |
@vishuk570 yes that worked for us. If anyone has trouble reproducing this issue, or want to confirm they have fixed it, you might like to try my testing component that I detailed in an earlier comment. |
facebook/react-native#17530 and crash 2: disable hermes for a better crash report
I find that it is also useful to change StateList like this:
it just puts the line maybe the root cause of this problem is related to the order of StateList, but i didn't get the evidence. |
- Removed undeline decoration for carousel buttons. Due the possible fatar error described on this issue: facebook/react-native#17530 - This bugged already happenend once in development, and it blocks permanently access to app after occurs once, no matter how many times the app is restarted.
I tried many things on this page and also used a similar approach on reproducing the crash as @jcdhlzq. I found that removing the key property reduced the amount of crashes but they were still there. What finally fixed it for me was adding these lines to the In your styles, try setting explicit background colors
|
Is this a bug report?
yes
Have you read the Contributing Guidelines?
yes, I am sorry that I cant offer more information about this exception except for this stack trace because the crash report was collected from google analytics, I have no idea to reappear this exception.
Environment
Environment:
OS: macOS Sierra 10.12.6
Node: 8.4.0
Yarn: 0.27.5
npm: 5.4.0
Android Studio: 3.0
Packages: (wanted => installed)
react-native: 0.51.0 => 0.51.0
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
Target Platform: Android (7.1.1)
mobile:MIX 2
android:7.1.1
java.lang.NullPointerException:
tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference at
android.graphics.drawable.DrawableContainer$DrawableContainerState.getChild(DrawableContainer.java:888) at
android.graphics.drawable.DrawableContainer.selectDrawable(DrawableContainer.java:466) at
android.graphics.drawable.StateListDrawable.onStateChange(StateListDrawable.java:104) at
android.graphics.drawable.Drawable.setState(Drawable.java:735) at
android.graphics.drawable.DrawableWrapper.onStateChange(DrawableWrapper.java:331) at
android.graphics.drawable.Drawable.setState(Drawable.java:735) at
android.graphics.drawable.LayerDrawable.onStateChange(LayerDrawable.java:1488) at
android.graphics.drawable.Drawable.setState(Drawable.java:735) at
android.view.View.drawableStateChanged(View.java:18002) at
android.widget.TextView.drawableStateChanged(TextView.java:4097) at
android.view.View.refreshDrawableState(View.java:18071) at
android.view.View.setPressed(View.java:8543) at
android.view.View.setPressed(View.java:8521) at
android.view.View.onTouchEvent(View.java:11218) at
android.widget.TextView.onTouchEvent(TextView.java:8467) at
com.facebook.react.views.textinput.ReactEditText.onTouchEvent(ReactEditText.java:150)
The text was updated successfully, but these errors were encountered: