Autofill framework updates 8.1 cause crash to EditText

Related searches

I updated my phone to 8.1 from 8.0 and now I am getting this crash when I am trying to tap any EditText or com.rengwuxian.materialedittext.MaterialEditText on my app (which is built with API Level 25).

FATAL EXCEPTION: main                                                                              
java.lang.NullPointerException: activityToken
at android.os.Parcel.readException(Parcel.java:2010)
at android.os.Parcel.readException(Parcel.java:1950)
at android.view.autofill.IAutoFillManager$Stub$Proxy.startSession(IAutoFillManager.java:381)
at android.view.autofill.AutofillManager.startSessionLocked(AutofillManager.java:993)
at android.view.autofill.AutofillManager.notifyViewEntered(AutofillManager.java:595)
at android.view.autofill.AutofillManager.notifyViewEntered(AutofillManager.java:566)
at android.view.View.notifyEnterOrExitForAutoFillIfNeeded(View.java:6980)
at android.view.View.onFocusChanged(View.java:6966)
at android.widget.TextView.onFocusChanged(TextView.java:9606)
at android.view.View.handleFocusGainInternal(View.java:6631)
at android.view.View.requestFocusNoSearch(View.java:10868)
at android.view.View.requestFocus(View.java:10847)
at android.view.View.requestFocus(View.java:10814)
at android.view.View.requestFocus(View.java:10756)
at android.view.View.onTouchEvent(View.java:13018)
at android.widget.TextView.onTouchEvent(TextView.java:9665)
at com.rengwuxian.materialedittext.MaterialEditText.onTouchEvent(MaterialEditText.java:1501)
at android.view.View.dispatchTouchEvent(View.java:11776)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2968)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:448)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1829)
at android.app.Activity.dispatchTouchEvent(Activity.java:3307)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:410)
at android.view.View.dispatchPointerEvent(View.java:12015)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4795)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4609)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4293)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4350)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4200)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4166)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4174)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4147)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6661)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6635)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6596)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6764)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:186)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:325)
at android.os.Looper.loop(Looper.java:142)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

The layout is as follows:

 <com.rengwuxian.materialedittext.MaterialEditText
                    android:id="@+id/usernameET"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/padding_xlarge"
                    android:layout_marginTop="@dimen/padding_large"
                    android:enabled="@{!loading}"
                    android:hint="@string/username"
                    android:inputType="text"
                    android:lines="1"
                    android:maxLength="50"
                    android:maxLines="1"
                    android:singleLine="true"
                    android:textSize="@dimen/text_normal"
                    app:met_accentTypeface="fonts/averta_bold.otf"
                    app:met_floatingLabel="highlight"
                    app:met_floatingLabelText="@string/username"
                    app:met_primaryColor="@color/text_dark"
                    app:met_textColor="@color/text_blue"
                    app:met_typeface="fonts/averta_regular.otf" />

Can you please advise why this is happening and how I can fix it?

Thank you in advance!!!

I had similiar problem. Same error when tapping on EditText, on field in Webview. In my case the problem was using wrong Context within attachBaseContext method.

Old code

override fun attachBaseContext(newBase: Context?) {
   super.attachBaseContext(applicationContext.createConfigurationContext(...))
}

Fixed code:

override fun attachBaseContext(newBase: Context?) {
    super.attachBaseContext(newBase.createConfigurationContext(...))
}

No more errors with Autofill framework. I suggest checking if you didn't make similar mistake missusing Context.

Optimize your app for autofill, Learn about the autofill framework available in Android 8.0 (API level 26) and later. Settings � Updates. Interact with peripherals The following example sets a "password" hint on an EditText : In Android 8.0 (API level 26) and 8.1 (API level 27), autofill can cause your app to crash in certain scenarios. When trying to edit text objects in AutoCAD, the program freezes (requiring exit via the Task Manager) or crashes. AutoCAD is missing latest updates. Windows 8.1 is being used with an older .NET Framework 4.5.1. Drawing file corruption, such as damaged or excessive text styles. Do one or more of the following: Install the latest updates for AutoCAD (see Install Updates,

Seems like a straight-up regression bug to me. I'm taking the most pragmatic approach possible by doing this in the Activity.onCreate:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
  getWindow().getDecorView().setImportantForAutofill(
      View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
}

Android 8.1 cause crash to EditText, Google has released the first preview of Android 8.1. Improved targeting for low -RAM devices; Autofill framework updates; EditText update to Android 8.1 as it may cause issues with the update (SystemUI force closes and crashes with the� In Android 8.0 (API level 26) and 8.1 (API level 27), autofill can cause your app to crash in certain scenarios. To work around any potential issues, you should tag any views that are not autofilled with importantForAutofill=no .

i spend time on this error:

Fatal Exception: java.lang.NullPointerException: activityToken
       at android.os.Parcel.readException + 2010(Parcel.java:2010)
       at android.os.Parcel.readException + 1950(Parcel.java:1950)
       at android.view.autofill.IAutoFillManager$Stub$Proxy.startSession + 397(IAutoFillManager.java:397)

Solution:

android:importantForAutofill="no" in XML file in Edit Text.

Solution: java.lang.NullPointerException: activityToken , Librazy changed the title Crash focusing on EditText when Autofill enabled Crash when I need to find a Android 8.1 device to test, it may take a while. I/ AndroidRuntime: VM exiting with result code 0, cleanup skipped. https://stackoverflow.com/questions/47763756/autofill-framework-updates-8-1-cause-crash-to-edittext down vote I had similiar problem. Same error when tapping on

Android 8.1 Oreo Preview 1 Big Bug Thread, Dimitris is currently Co-founder and Head of Mobile at Trebbble. Dimitris oversees the development cycle of all mobile solutions of the company.

Crash when focusing on EditText with Autofill enabled � Issue #200 , Similar Threads - Crash caused EditText New Game: Crash Ballistix (Version 0.1) App Update , Aug 21, 2020 at 10:36 AM , in forum: Android Apps & Games

I'll import another Android code sample and this time I'll choose autofill framework under Android O preview and I'll download and open the project. Once again, if you're prompted to update your Grade O plugin, click the update button as many times as you need to. This application comes with the minimum and target (mumbles) versions both set to

Comments
  • Nice! this solved my issue with autofill crashes on android 8.1 webviews. But still don't really understand why this happens, and only in this specific version of android. Any ideas why?
  • Great answer! I would never found the culprit myself. The place where the crash happens have nothing to do with the place where the problem starts. You Save me a lot of time!
  • you can also add android:importantForAutofill="no" in xml and suppress lint for warning to apply a cleaner fix :)