Saturday, August 3, 2019

Try Changing your Virtual Device/Emulator from Android Q to Pie if you have Problems with Flutter

As I'm playing around with designing and building a flutter app I learned that it's not always good to go with the latest and greatest. Appears there are some kinks to work out with Android Q or API 29 emulators.

I switched to Android Pie to avoid this error:

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
***Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:59999/nnnBU4fdaqs=/ws
Exited (sigterm)

I found the answer on stack overflow:
https://stackoverflow.com/questions/55879550/how-to-fix-httpexception-connection-closed-before-full-header-was-received/56727663#56727663

If you run into this problem and want to downgrade your emulator instead of creating a new one, make sure you run a "cold boot" instead of a "quick boot" the first time you launch. Else, you'll run into another error about not finding "Service: package".
https://stackoverflow.com/questions/53532810/error-launching-application-on-android-sdk-built-for-x86/57342596#57342596

Pie is a much tastier name than Q anyways.