Getting a NullpointerException on Samsung Galaxy S21+ Only for nativeGetStyleAttribute

Viewed 208

The NullPointerException is getting for all the devices running Android 10 and above, only if "View Attribute Inspection" option enabled from Developer Options. But specifically for Samsung Galaxy S21+ is getting this issue even the "View Attribute Inspection" option is disabled. Any help would be appreciated.

    java.lang.NullPointerException
    at android.content.res.XmlBlock.nativeGetStyleAttribute(Native Method)
    at android.content.res.XmlBlock.access$1500(XmlBlock.java:41)
    at android.content.res.XmlBlock$Parser.getStyleAttribute(XmlBlock.java:459)
    at android.content.res.Resources$Theme.getExplicitStyle(Resources.java:1937)
    at android.view.View.retrieveExplicitStyle(View.java:7009)
    at android.view.View.<init>(View.java:5893)
    at android.view.ViewGroup.<init>(ViewGroup.java:715)
    at android.widget.RelativeLayout.<init>(RelativeLayout.java:255)
    at android.widget.RelativeLayout.<init>(RelativeLayout.java:251)
1 Answers

I first saw this issue after attaching the layout inspector in Android Studio. But after I stopped using the layout inspector the issue persisted.

I had to factory reset my device to get rid of this issue. Exact same code - but a factory reset fixed the problem. It's like the device got stuck with View Attribute Inspection turned on even though I turned it off in settings.

Related