Android Studio 3.1 EditText StackOverflowError [英] Android Studio 3.1 EditText StackOverflowError
问题描述
更新到 Android Studio 3.1 后,当 EditText 处于焦点时,我遇到异常
After updating to Android Studio 3.1 I'm facing exception when EditText in focus
E/AndroidRuntime: FATAL EXCEPTION: main
Process: <package>, PID: 18938
java.lang.StackOverflowError: stack size 8MB
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
at android.view.inputmethod.InputConnectionWrapper.getTextBeforeCursor(InputConnectionWrapper.java:46)
知道如何解决这个问题吗?
Any idea how to fix this?
更新:
经过一些研究,我发现 StackOverflowError 出现在带有简单 EditText 的不同堆栈跟踪中:
After some research I found out that StackOverflowError appears with different stacktraces with simple EditText:
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"/>
当我尝试输入任何符号时:
When trying to enter any symbol I get:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: <package>, PID: 21122
java.lang.StackOverflowError: stack size 8MB
at android.view.inputmethod.InputConnectionWrapper.beginBatchEdit(InputConnectionWrapper.java:106)
当我按下回键时:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: <package>, PID: 21280
java.lang.StackOverflowError: stack size 8MB
at android.view.inputmethod.InputConnectionWrapper.finishComposingText(InputConnectionWrapper.java:78)
即使在 WebView 中输入文本也会导致此错误
Even entering text in WebView causing this error
在 AS 3.0 EditText 中正常工作
In AS 3.0 EditText's worked normal
推荐答案
正如 @evi 指出的那样,
As @evi pointed out there is a bug in advanced profiling.
暂时禁用它(编辑配置设置 -> 分析 -> 启用高级分析) 防止 EditText 崩溃
For now disabling it (Edit configuration settings -> Profiling -> Enable advanced profiling) prevents EditText from crashing
更新:
在 Android Studio 3.1.1 中发布的修复
再次提供高级分析!
这篇关于Android Studio 3.1 EditText StackOverflowError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!