Those pits encountered by Flutter

Cannot connect to the night simulator

IDEA or Android Studio cannot detect the late night emulator. Can not connect.

According to some statements on the Internet, it may be caused by the difference between the adb.exe version in the Android SDK platform-tools directory and the adb.exe version of the night emulator.

solution

Copy adb.exe in the Android SDK platform-tools directory to the Nox\bin directory of the night emulator, and replace the original adb.exe. If it still doesn't work, rename it to nox_adb.exe, the file may already exist, just replace it. (This method is effective in pro-testing.)

E/DartVM (3900): vm-service: Error: Unhandled exception: …… A white screen is displayed after the app runs

This problem has been plagued for a long time at first, and the following error will be reported every time it runs, prompting that the emulator cannot be connected, a certain exception occurs, and the app on the emulation has stopped on the white screen interface.

E/DartVM  ( 3900): vm-service: Error: Unhandled exception:
E/DartVM  ( 3900): WebSocketException: Invalid WebSocket upgrade request
E/DartVM  ( 3900): 
E/flutter ( 3900): [ERROR:flutter/runtime/dart_isolate.cc(865)] Unhandled exception:
E/flutter ( 3900): WebSocketException: Invalid WebSocket upgrade request
Connecting to the VM Service is taking longer than expected...
Still attempting to connect to the VM Service...
If you do NOT see the Flutter application running, it might have crashed. The device logs (e.g. from adb or XCode) might have more details.
If you do see the Flutter application running on the device, try re-running with --host-vmservice-port to use a specific port known to be available.

Insert picture description here

solution

Open the terminal and enter

flutter doctor

Check if there is a warning, NO_PROXY is not configured. If there is, then the problem lies here.

Insert picture description here

We just need to configure it in the environment variables NO_PROXY.

For Window system users: Right click on My Computer -> Properties -> Advanced System Properties -> Environment Variables

Choose to create a new environment variable.

Insert picture description here

Insert picture description here

Copy the following content and enter it into the corresponding location.

NO_PROXY
localhost,127.0.0.1

Then press OK all the way to save the settings.

Reopen a terminal and input flutter doctor, at this time, the previous warning is gone

Insert picture description here

Then it can run normally.

It is best to restart the IDE and simulator, and run the project. Although I don’t know why, I tried several times. After the configuration is complete, the IDE and simulator must be rebuilt to take effect.

For users of MAC system

In .bash_profileadding the following passage

export NO_PROXY=localhost,127.0.0.1

After modification

source ~/.bash_profile

In the end, it should be able to be used normally without accident, if notRestart the computer

Flutter Provider^4.3.2+3 pit record

Flutter Provider^4.3.2+3 pit record

The app developed by Flutter cannot load network resources under real machine debugging

The app developed by Flutter cannot load network resources under real machine debugging

If it is helpful to you, please like and pay attention to it! ! !

Guess you like

Origin blog.csdn.net/qq_43058685/article/details/108820143