Closed Rickyballs closed 3 years ago
Hi @Rickyballs
Can you please provide your flutter run --verbose
and a minimal complete reproducible code sample?
Thank you
This is the main part of the code
class WebViewExample extends StatefulWidget {
@override
WebViewExampleState createState() => WebViewExampleState();
}
class WebViewExampleState extends State<WebViewExample> {
@override
void initState() {
super.initState();
// Enable hybrid composition.
// if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
}
/// loadfinish()
void _webViewFinishLoadRequestCallback(String url) {
_progress=1.0;
if (mounted) {
setState(() {
//do sth
});
}
}
@override
Widget build(BuildContext context) {
return Material(
child: new Column(
children: <Widget>[
_linearProgressWidget(),
_body(),
// _webLogoutWidget(),
],
),
);
}
Widget _body() {
return new Expanded(
child: _webView(),
);
}
/// webView
Widget _webView() {
return Container(
child: WebView(
initialUrl: "https://www.baidu.com/",
javascriptMode: JavascriptMode.unrestricted,
onPageFinished: _webViewFinishLoadRequestCallback,
),
);
}
double _progress=0.45;
Widget _linearProgressWidget() {
if (1.0 == _progress) {
///if return Container(height:3.0); Crash would not happen;
return new Padding(padding: new EdgeInsets.only());
}
return new Container(
child: new LinearProgressIndicator(
backgroundColor: new Color(0x00FFFFFF),
value: _progress,
valueColor: new AlwaysStoppedAnimation<Color>(new Color(0xFF24C77E)),
),
height: 3.0,
);
}
}
Yesterday's experiment found that as long as there is no height change after initialization, it will not crash. This strange problem only appears on HuaWei Nova. Others of the same system will not have such problems.
[ +131 ms] executing: [F:\flutter1.22.2\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H [ +314 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H [ ] 84f3d28555368a70270e9ac8390a9441df95e752 [ +1 ms] executing: [F:\flutter1.22.2\flutter/] git tag --points-at HEAD [ +380 ms] Exit code 0 from: git tag --points-at HEAD [ ] 1.22.2 [ +11 ms] executing: [F:\flutter1.22.2\flutter/] git rev-parse --abbrev-ref --symbolic @{u} [ +179 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u} [ +1 ms] origin/stable [ ] executing: [F:\flutter1.22.2\flutter/] git ls-remote --get-url origin [ +163 ms] Exit code 0 from: git ls-remote --get-url origin [ ] https://github.com/flutter/flutter.git [ +236 ms] executing: [F:\flutter1.22.2\flutter/] git rev-parse --abbrev-ref HEAD [ +174 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD [ +1 ms] stable [ +104 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update. [ ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +18 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +25 ms] executing: E:\SDK\platform-tools\adb.exe devices -l [ +116 ms] List of devices attached 925fedd4 device product:gemini model:MI_5 device:gemini transport_id:6 debug2.testin.cn:4082 device product:CAZ-AL10 model:HUAWEI_CAZ_AL10 device:HWCAZ transport_id:10 [ +8 ms] E:\SDK\platform-tools\adb.exe -s 925fedd4 shell getprop [ +206 ms] E:\SDK\platform-tools\adb.exe -s debug2.testin.cn:4082 shell getprop [ +232 ms] Artifact Instance of 'AndroidMavenArtifacts' is not required, skipping update. [ +5 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update. [ +1 ms] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update. [ +3 ms] Artifact Instance of 'FlutterWebSdk' is not required, skipping update. [ +3 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update. [ ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update. [ ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update. [ +113 ms] Multiple devices found: [ +3 ms] ro.hardware = qcom [ +2 ms] ro.hardware = qcom [ +3 ms] MI 5 (mobile) • 925fedd4 • android-arm64 • Android 7.0 (API 24) [ +1 ms] HUAWEI CAZ AL10 (mobile) • debug2.testin.cn:4082 • android-arm64 • Android 7.0 (API 24) [ +1 ms] [0]: MI 5 (925fedd4) [ ] [1]: HUAWEI CAZ AL10 (debug2.testin.cn:4082) [ +1 ms] Please choose one (To quit, press "q/Q") [ ] :
Can't reproduce this because I don't own a Huawei device mentioned above. The issue does not reproduce on my emulators and physical Xiaomi 5Plus device.
This problem is not serious. I have no problem with other mobile phones except this one. Besides,It's hard to find HuaWei nova. It doesn't trigger as long as you don't change the height.
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.
Here is the flutter doctor
Steps to Reproduce
Logs
``` java.lang.NullPointerException Attempt to invoke virtual method 'void android.view.Display.getSize(android.graphics.Point)' on a null object reference org.chromium.ui.display.DisplayAndroid.updateFromDisplay(DisplayAndroid.java:280) org.chromium.ui.display.DisplayAndroidManager$DisplayListenerBackendImpl.onDisplayChanged(DisplayAndroidManager.java:176) android.hardware.display.DisplayManagerGlobal$DisplayListenerDelegate.handleMessage(DisplayManagerGlobal.java:495) android.os.Handler.dispatchMessage(Handler.java:105) android.os.Looper.loop(Looper.java:156) android.app.ActivityThread.main(ActivityThread.java:6517) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832) ```