本文介绍了单击具有最新更新的EditText时,应用程序崩溃(等级4.4-Android Studio 3.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将android studio更新到了3.1版,并将gradle更新到了4.4版.从那以后,当我点击EditText会弹出一个软输入键盘时,我就遇到了应用程序进入ANR的问题.单击EditText时,我看到有多个GC被触发,最终应用程序崩溃,并显示ANR消息,表明堆栈溢出超过8 MB.这是我看到的崩溃: http://crashes.to/s/77a48e5d43c .还要在这里粘贴:

I recently updated my android studio to version 3.1 and also my gradle to version 4.4. Since, then I have been facing this issue of app going into ANR when clicking on an EditText that should popup a soft input keyboard. On clicking on an EditText I see that there are multiple GCs that get triggered and eventually the app crashes with and ANR message saying that there is a stack overflow exceeding the size of 8 MB. Here is the crash that I see: http://crashes.to/s/77a48e5d43c. Also pasting it here:

Fatal Exception: java.lang.StackOverflowError: stack size 8MB
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at android.view.inputmethod.InputConnectionWrapper.reportFullscreenMode(InputConnectionWrapper.java:122)
   at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:416)
   at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5268)
   at java.lang.reflect.Method.invoke(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:902)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697)

以下是我如何使用EditText的代码段:

Here is a snippet of how I have used EditText:

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayout2"
    android:layout_width="@dimen/login_screen_elem_width"
    android:layout_height="wrap_content"
    android:layout_marginTop="24dp"
    app:layout_constraintStart_toStartOf="@+id/fbLogin"
    app:layout_constraintTop_toBottomOf="@+id/fbLogin">

    <android.support.design.widget.TextInputEditText
        android:id="@+id/etFirstName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/first_name"
        android:imeOptions="flagNoExtractUi|actionNext"
        android:inputType="textPersonName"
        android:maxLines="1"
        android:textColor="@color/secondaryTextColour"
        android:textSize="16dp" />

</android.support.design.widget.TextInputLayout>

仅供参考:当我尝试单击我的PreferenceFragmentCompat中的文本项时,我也遇到类似的问题.

FYI: I also face similar issue when I try to click on a text item in the my PreferenceFragmentCompat.

推荐答案

这里有其他相关答案: https://stackoverflow.com/a/49112444/3669559

Here related other answer: https://stackoverflow.com/a/49112444/3669559

您将收到 java.lang.StackOverflowError ,这意味着您很可能已经递归且连续地调用了一些方法.这会导致无限循环和此错误.

You are getting java.lang.StackOverflowError which means most possibly you have calling some methods recursively and continuously. That causes infinite loop and this error.

如果此EditText上具有 TextWatcher OnFocusChangeListener 之类的任何侦听器,则需要进行检查.

If you have TextWatcher or any listener like OnFocusChangeListener on this EditText, you need to check it.

这篇关于单击具有最新更新的EditText时,应用程序崩溃(等级4.4-Android Studio 3.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 17:12