'NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable
Can I know the what is this error and a solution for this? This error occurred at react native apps randomly, in both debug mode and APKs. reproducing this error is difficult.
I saw this issue in github github-https://github.com/facebook/react-native/issues/17530.
but the solution is not a proper one. Is there a proper solution for this error.
Solution 1:[1]
It occurs randomly. Just uninstall the app from mobile and restart the server by resetting the cache.
Solution 2:[2]
Just close the app and open it again the problem will be solved. But if anyone knows a better way please let me know.
Solution 3:[3]
Try to run below command. This worked for me.
npm start --reset-cache
Solution 4:[4]
You can try both and either of the points, whichever works for your app:
- Delete the cache data of your app and let it reload
- Restart the server using npm start --reset-cache
Solution 5:[5]
For me this error was resolved so I closed npm and then executed the:
`react-native run-android.`
Solution 6:[6]
https://github.com/facebook/react-native/pull/29452/files Hope this works. This error arrives due to multiple rerendering of textInput(s).
Solution 7:[7]
- close the app
- restart the server using
npm start --reset-cache
npm run android
(didn't need to uninstall the app)
Solution 8:[8]
Add the flowing line of code into /android/app/src/main/res/values/styles.xml
.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:editTextBackground">@android:color/transparent</item>
...
</style>
Hope this will work. Happy coding.....
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Harshal |
Solution 2 | |
Solution 3 | Hp Sharma |
Solution 4 | Programmer_Bee |
Solution 5 | Hossein CH |
Solution 6 | Muhammad Usama |
Solution 7 | Amin Dannak |
Solution 8 | Prosanta Chaki |