Skip to content

java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.editing.TextInputPlugin.onProvideAutofillVirtualStructure(android.view.ViewStructure, int)' on a null object reference #149792

Closed

Description

@marchlqq

Steps to reproduce

1、update flutter version from 3.3.9 to 3.16.9
2、Open the phone settings and turn on the application password book function
3、create a viewpage fragment, one is native fragment and has edit, other is flutter fragment and init
then,
When you click on the edit box of the native fragment, it will inevitably collapse and appear.

Expected results

click normal

Actual results

java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.editing.TextInputPlugin.onProvideAutofillVirtualStructure(android.view.ViewStructure, int)' on a null object reference
at io.flutter.embedding.android.FlutterView.onProvideAutofillVirtualStructure(FlutterView.java:1525)
at android.view.View.dispatchProvideStructure(View.java:10364)
at android.view.View.dispatchProvideAutofillStructure(View.java:10356)
at android.view.ViewGroup.dispatchProvideAutofillStructure(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchProvideAutofillStructure(ViewGroup.java:3728)
at android.view.ViewGroup.dispatchProvideAutofillStructure(ViewGroup.java:3728)
at android.app.assist.AssistStructure$WindowNode.<init>(AssistStructure.java:527)
at android.app.assist.AssistStructure.<init>(AssistStructure.java:2345)
at android.app.ActivityThread.handleRequestAssistContextExtras(ActivityThread.java:4101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2427)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at android.app.ActivityThread.main(ActivityThread.java:8423)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Code sample

Code sample
        fragmentList = new ArrayList<>();
        nativeFragment = new NativeFragment();

        addFragmentThenHide(R.id.fragment_stub, nativeFragment, "tab_" + 0);

        mesFragment = new MsgFlutterFragment
                .CachedEngineFragmentBuilder(MsgFlutterFragment.class)
                .url("tab_message")
                .build();

        addFragmentThenHide(R.id.fragment_stub, mesFragment, "tab_" + 2);

        friendFragment = new FriendFlutterFragment
                .CachedEngineFragmentBuilder(FriendFlutterFragment.class)
                .url("tab_friend")
                .build();

Screenshots or Video

Screenshots / Video demonstration

mtp_test_demo.zip

Logs

Logs
java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.editing.TextInputPlugin.onProvideAutofillVirtualStructure(android.view.ViewStructure, int)' on a null object reference
at io.flutter.embedding.android.FlutterView.onProvideAutofillVirtualStructure(FlutterView.java:1525)
at android.view.View.dispatchProvideStructure(View.java:10364)
at android.view.View.dispatchProvideAutofillStructure(View.java:10356)
at android.view.ViewGroup.dispatchProvideAutofillStructure(ViewGroup.java:3708)
at android.view.ViewGroup.dispatchProvideAutofillStructure(ViewGroup.java:3728)
at android.view.ViewGroup.dispatchProvideAutofillStructure(ViewGroup.java:3728)
at android.app.assist.AssistStructure$WindowNode.<init>(AssistStructure.java:527)
at android.app.assist.AssistStructure.<init>(AssistStructure.java:2345)
at android.app.ActivityThread.handleRequestAssistContextExtras(ActivityThread.java:4101)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2427)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at android.app.ActivityThread.main(ActivityThread.java:8423)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Flutter Doctor output

Doctor output
[Paste your output here]

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Jun 6, 2024
  2. marchlqq commented on Jun 6, 2024

    @marchlqq
    Author

    FlutterView method:
    public void onProvideAutofillVirtualStructure(@nonnull ViewStructure structure, int flags) {
    super.onProvideAutofillVirtualStructure(structure, flags);
    this.textInputPlugin.onProvideAutofillVirtualStructure(structure, flags);
    }

    This method adds try-catch, which can be added, but it is difficult and there is no other way to deal with this problem.

  3. huycozy commented on Jun 6, 2024

    @huycozy
    Member

    Hi @marchlqq

    Open the phone settings and turn on the application password book function

    What is passwork book function? Which Android device are you using? (OS, model)

    Also, the goal of this Github repo is not to assist in personal code or the whole package/plugin project but to improve Flutter framework reporting bugs or feature requests. Your sample code (mtp_test_demo.zip) is a package project that contains the complex implementation and also uses 3rd packages.

    For the issue to be workable, it needs to be reproducible with a completed and minimal reproducible code sample that doesn’t include 3rd party plugins or complex production code. Please provide such a sample and please provide output of flutter doctor -v as well.

  4. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 6, 2024
  5. marchlqq commented on Jun 6, 2024

    @marchlqq
    Author

    hi @huycozy
    1、演示视频

    2、Mobile phone: pad or folding screen mobile phone

  6. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 6, 2024
  7. marchlqq commented on Jun 6, 2024

    @marchlqq
    Author

    Current demo:
    mtp_test_demo.zip

    A complete and minimal reproducible code example is not available yet.

  8. huycozy commented on Jun 7, 2024

    @huycozy
    Member

    Please try to provide a minimal sample code so that we can look into it easier. Thanks!

  9. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 7, 2024
  10. marchlqq commented on Jun 7, 2024

    @marchlqq
    Author

    Please try to provide a minimal sample code so that we can look into it easier. Thanks!

    The problem occurs when:

    public void onProvideAutofillVirtualStructure(@nonnull ViewStructure structure, int flags) {
    super.onProvideAutofillVirtualStructure(structure, flags);
    this.textInputPlugin.onProvideAutofillVirtualStructure(structure, flags);
    }
    

    I clicked on the initial interface and the input method popped up, but because the system password book function was turned on, a rough code was run, but the textInputPlugin was not initialized, so it crashed.

    I want to add try-catch to this method body.

  11. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 7, 2024
  12. huycozy commented on Jun 10, 2024

    @huycozy
    Member

    To help us look at the issue more easily, please narrow the issue down by removing the usage of 3rd party plugins/packages one by one, unrelated/unaffected code, and isolating the issue into a minimal sample code. And please share it here when you have such an example. Thanks!

  13. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jun 10, 2024
  14. github-actions commented on Jul 1, 2024

    @github-actions

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
    If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
    Thanks for your contribution.

  15. github-actions commented on Jul 15, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  16. locked as resolved and limited conversation to collaborators on Jul 15, 2024
  17. added a commit that references this issue on Dec 30, 2025
    48c0bfa
  18. added a commit that references this issue on Feb 10, 2026
    ed1922e
  19. added a commit that references this issue on Feb 19, 2026
    9f0d679
  20. added a commit that references this issue on Mar 26, 2026
    e889c2e
  21. added a commit that references this issue on Sep 28, 2026
    2c3ebfc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in triagePresently being triaged by the triage teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions