1

This is a very strange bug that happens on a Galaxy Grand Prime on Android 5.0.1.

If I long-click any TextInputEditText or EditText, the app crashes with the following log:

FATAL EXCEPTION: main
                                                                          Process: com.x.x, PID: 22222
                                                                          android.view.InflateException: Binary XML file line #17: Error inflating class TextView
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
                                                                              at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3423)
                                                                              at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2595)
                                                                              at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3380)
                                                                              at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3380)
                                                                              at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:4430)
                                                                              at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:4791)
                                                                              at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:5230)
                                                                              at android.widget.Editor.performLongClick(Editor.java:978)
                                                                              at android.widget.TextView.performLongClick(TextView.java:9273)
                                                                              at android.view.View$CheckForLongPress.run(View.java:20253)
                                                                              at android.os.Handler.handleCallback(Handler.java:739)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                              at android.os.Looper.loop(Looper.java:135)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5910)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at java.lang.reflect.Method.invoke(Method.java:372)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
                                                                           Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=386
                                                                              at android.content.res.StringBlock.get(StringBlock.java:65)
                                                                              at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:482)
                                                                              at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:1003)
                                                                              at android.content.res.TypedArray.getString(TypedArray.java:177)
                                                                              at android.widget.TextView.<init>(TextView.java:1087)
                                                                              at android.widget.TextView.<init>(TextView.java:685)
                                                                              at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:62)
                                                                              at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:58)
                                                                              at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:103)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1029)
                                                                              at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1087)
                                                                              at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:47)
                                                                              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
                                                                              at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
                                                                              at android.widget.Editor$ActionPopupWindow.initContentView(Editor.java:3423) 
                                                                              at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:2595) 
                                                                              at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3380) 
                                                                              at android.widget.Editor$ActionPopupWindow.<init>(Editor.java:3380) 
                                                                              at android.widget.Editor$HandleView.showActionPopupWindow(Editor.java:4430) 
                                                                              at android.widget.Editor$InsertionHandleView.showWithActionPopup(Editor.java:4791) 
                                                                              at android.widget.Editor$InsertionPointCursorController.showWithActionPopup(Editor.java:5230) 
                                                                              at android.widget.Editor.performLongClick(Editor.java:978) 
                                                                              at android.widget.TextView.performLongClick(TextView.java:9273) 
                                                                              at android.view.View$CheckForLongPress.run(View.java:20253) 
                                                                              at android.os.Handler.handleCallback(Handler.java:739) 
                                                                              at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                                              at android.os.Looper.loop(Looper.java:135) 
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5910) 
                                                                              at java.lang.reflect.Method.invoke(Native Method) 
                                                                              at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) 
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

This occurs in various activities and across multiple apps. So far, I'm at a loss as to what to make of this. I initially thought replacing TextInputEditText with plain old EditText would fix the issue but it didn't.

The relevant XML:

<android.support.design.widget.TextInputEditText
            android:id="@+id/address"
            android:layout_width="200dp"
            android:layout_height="wrap_content"
            android:hint="@string/address"
            android:inputType="textPostalAddress"/>
Asim
  • 6,962
  • 8
  • 38
  • 61
  • Are you using the `Samsung custom keyboard` ? – Shark Jul 26 '17 at 11:34
  • Can you post your style , which you applied for TextInputLayout in xml – Vishal Vaishnav Jul 26 '17 at 11:34
  • it looks like a bug? may be an error when OS try to inflate the menu that will appear on long click? mostly the one has **copy/paste/select all** options, what brought my attention is this `Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=386` is 15 the number of chars in the text box at the long click time? or it's something related about the layout of that menu ? – Yazan Jul 26 '17 at 11:42
  • @Shark Yes, the default Samsung keyboard. – Asim Jul 26 '17 at 11:51
  • @VishalVaishnav added. – Asim Jul 26 '17 at 11:53
  • @Yazan The error remains the same regardless of the input. Even on an empty field, it says length=15, index=386. – Asim Jul 26 '17 at 11:53
  • Interestingly, I am getting this error in one out of my two applications running on the same device. The difference between the two is the one where its working i have created a custom class since i wanted to modify the font. This happens to me on Android version 5.x only. Does not replicated on 6.x and 7.x currently. – Jayshil Dave Aug 06 '17 at 15:28
  • @Asim This worked for me. https://stackoverflow.com/questions/38103265/runtimeexception-when-clicking-on-edittext The answer where we need to remove the font family – Jayshil Dave Aug 06 '17 at 16:11

0 Answers0