Flutter url_launcher hangs after browser opens

178 views Asked by At

I'm having a problem launching URLs from my Flutter app on Android emulator. I've scaled it back to a minimal example of my problem is this:

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () async {
          await launchUrl(Uri.parse('https://www.google.com'));
        },
        child: const Icon(Icons.add),
      ),
    ));
  }
}

When I click the floating action button, the browser opens using the proper url, but then it hangs. It doesn't finish loading, and the emulator itself becomes unresponsive, and I have to shut it down and restart it. I've tried in release and debug mode, but it's the same result. It might be a problem with my AndroidManifest.xml file, but I haven't been able find the correct combination. I have the following line included:

    <uses-permission android:name="android.permission.INTERNET" />

and I've included different intents and filters, such as the examples given here, here, and here. But I keep getting the same problem. I assume it's probably something dumb I'm missing, but if anyone has any suggestions, I would be appreciative.

0

There are 0 answers