Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Stringblock.get NullPointer Exception on Lollipop

I am getting a crash on Android Lolipop.

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference   
at android.content.res.AssetManager.getResourceValue(AssetManager.java:213) 
at android.content.res.Resources.getValue(Resources.java:1334)  
at android.content.res.Resources.getValue(Resources.java:1323)  
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2796) 
at android.content.res.Resources.getLayout(Resources.java:1143) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:412)

Generally happens while inflating a view. Any suggestions why it happens on Lollipop only ?

like image 691
Gaurav Avatar asked Nov 25 '15 11:11

Gaurav


1 Answers

It is may be because of an attribute is null.

For example android:foreground="?android:attr/selectableItemBackground" may be null, try to use android:foreground="?attr/selectableItemBackground".

like image 167
Александр Кундрюков Avatar answered Oct 20 '22 14:10

Александр Кундрюков