Repository navigation
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
Copy link
Copy link
Closed
Labels
in triagePresently being triaged by the triage teamPresently being triaged by the triage teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Description
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
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]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in triagePresently being triaged by the triage teamPresently being triaged by the triage teamwaiting for responseThe Flutter team cannot make further progress on this issue until the original reporter respondsThe Flutter team cannot make further progress on this issue until the original reporter responds
Activity
marchlqq commentedon Jun 6, 2024
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.
huycozy commentedon Jun 6, 2024
Hi @marchlqq
What is
passwork bookfunction? 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 -vas well.marchlqq commentedon Jun 6, 2024
hi @huycozy
1、演示视频
2、Mobile phone: pad or folding screen mobile phone
marchlqq commentedon Jun 6, 2024
Current demo:
mtp_test_demo.zip
A complete and minimal reproducible code example is not available yet.
huycozy commentedon Jun 7, 2024
Please try to provide a minimal sample code so that we can look into it easier. Thanks!
marchlqq commentedon Jun 7, 2024
The problem occurs when:
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.
huycozy commentedon Jun 10, 2024
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!
github-actions commentedon Jul 1, 2024
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.
github-actions commentedon Jul 15, 2024
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 -vand a minimal reproduction of the issue.fix(android): add null check for textInputPlugin in FlutterView
fix(android): add null check for textInputPlugin in FlutterView (#180386
fix(android): add null check for textInputPlugin in FlutterView (flut…
fix(android): add null check for textInputPlugin in FlutterView (flut…
fix(android): add null check for textInputPlugin in FlutterView (#180…