My Flutter app functions correctly on API level 30 or lower and on real devices with higher API levels. However, when I run it on an emulator with an API level above 30, it fails during installation with the error message: "Error connecting to the service protocol: failed to connect to http://127.0.0.1:51427/xFHsz1qdYHY=/ the Dart compiler exited unexpectedly." I have tried uninstalling the app, wiping the emulator data, and cold rebooting the emulator, but the issue persists. Any insights on resolving this would be appreciated.
Tried reinstalling app, expected successful installation.
After running flutter run –verbose
enter image description here
2
Answers
Add the following two lines to the
android/app/build.gradle
file:Can you mention the
compilesdk
,targetsdk
,minsdk
version in the app-levelbuild.gradle
file.make the
targetsdkversion
to 34(latest) .please mention if it doesn’t work. Also post some screenshots of
build.gradle
file.