Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter url_launcher does nothing or canLaunchUrl returns false

ErrorcanLaunchUrl returns false

Short answer

On Android 11 and newer, and on iOS, canLaunchUrl returns false for any scheme you have not declared. Add a queries entry to AndroidManifest.xml and an LSApplicationQueriesSchemes entry to Info.plist for each scheme. If it is still false, the device may simply have no app for that scheme.

  • Applies to Flutter 3.35, url_launcher 6.3, Android 11+, iOS 18
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Stop relying on canLaunchUrl for a moment and call launchUrl directly. It returns a bool, so you can see whether the launch itself fails.

    final ok = await launchUrl(Uri.parse('https://example.com'));
    debugPrint('launchUrl returned $ok');
  2. 2Match what you see, then jump to its fix

    1. 1canLaunchUrl is false on Android 11 or higher, even though a browser or dialer is installedAndroid: the scheme is not declared in a queries blockFix
    2. 2canLaunchUrl is false on an iPhone for a scheme such as tel or smsiOS: the scheme is missing from LSApplicationQueriesSchemesFix
    3. 3Nothing opens for tel: or mailto: on a simulator or an emulator image without a dialer or mail appThe device has no app that handles the schemeFix

What does the error look like?

  • canLaunchUrl returns false
  • Exception: Could not launch https://example.com
  • tel: and mailto: links do nothing on the emulator or simulator

Cause 1 of 3

Android: the scheme is not declared in a queries block

1Check

Open android/app/src/main/AndroidManifest.xml and look for a queries element. It must be a direct child of the root manifest element, and it needs one intent block per scheme you pass to canLaunchUrl.

grep -n -A12 "<queries>" android/app/src/main/AndroidManifest.xml

2Fix

Add the schemes you check. For web links, Android documents this intent. The block sits next to application, not inside it.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" />
        </intent>
        <!-- one more intent block for each other scheme you check, for example tel or sms -->
    </queries>
    <application ...>

3Verify

Stop the app, run it again (a hot reload does not re-read the manifest) and check the result.

flutter run

Confirmed by developer.android.com

Did this fix it?

Cause 2 of 3

iOS: the scheme is missing from LSApplicationQueriesSchemes

1Check

Look in ios/Runner/Info.plist for the LSApplicationQueriesSchemes key.

grep -n -A6 LSApplicationQueriesSchemes ios/Runner/Info.plist

2Fix

List every scheme you pass to canLaunchUrl.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>sms</string>
    <string>tel</string>
</array>

3Verify

Rebuild the iOS app and test on a device.

flutter run -d <device-id>

Confirmed by pub.dev

Did this fix it?

Cause 3 of 3

The device has no app that handles the scheme

1Check

Test the same link on a real phone. The package notes that iOS simulators have no default email or phone app, so those links cannot open there.

flutter devices

2Fix

Test tel and mailto on a real device. In the app, skip canLaunchUrl where you have a fallback: call launchUrl, and when it fails or throws, open an https page instead.

final uri = Uri(scheme: 'mailto', path: 'hello@example.com');
if (!await launchUrl(uri)) {
  await launchUrl(Uri.parse('https://example.com/contact'));
}

3Verify

On a real device the mail app opens; with none installed, the https fallback opens.

flutter run -d <device-id>

Confirmed by pub.dev

Did this fix it?

How do I stop it coming back?

  • Add the queries and LSApplicationQueriesSchemes entries in the same commit as the first canLaunchUrl call.
  • Treat the launchUrl result as a bool and always show a message or fallback when it is false.
  • Test tel, sms and mailto links on a real phone, not only on emulators.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.