【问题标题】:Unhandled Exception: MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/url_launcher)未处理的异常:MissingPluginException(在通道 plugins.flutter.io/url_launcher 上找不到方法 canLaunch 的实现)
【发布时间】:2021-09-30 06:52:19
【问题描述】:

未处理的异常:MissingPluginException(在通道 plugins.flutter.io/url_launcher 上找不到方法 canLaunch 的实现)

我在使用任何插件时收到此错误。上述错误来自使用 url_launcher。我也使用 image_picker 得到类似的错误。

这是我的 pubspec.yml 依赖列表

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.0
  flutter_facebook_login: ^3.0.0
  email_validator: ^2.0.1
  image_picker: ^0.8.4+1
  http: ^0.13.3
  get_it: ^7.2.0
  url_launcher: ^6.0.10

这是来自颤振医生 -v 的回应

[✓] Flutter (Channel stable, 2.2.3, on macOS 11.1 20C69 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/tarekfaysal/fvm/versions/stable
• Framework revision f4abaa0735 (3 months ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /users/tarekfaysal/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.11.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
  ???? https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
  ???? https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] VS Code (version 1.60.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0

[✓] Connected device (2 available)
• Mi A2 (mobile) • fff60a • android-arm64  • Android 10 (API 29)
• Chrome (web)   • chrome • web-javascript • Google Chrome 94.0.4606.61

• No issues found!

我尝试“flutter clean”并从本地设备卸载应用程序并执行“flutter run”,但此错误仍然存​​在。

请帮忙!

【问题讨论】:

    标签: flutter-plugin flutter-packages url-launcher


    【解决方案1】:

    正如documentation 所示,您需要将其添加到您的 androidManifest.xml 文件中(适用于 android):

    <queries>
      <!-- If your app opens https URLs -->
      <intent>
        <action android:name="android.intent.action.VIEW" />
        <data android:scheme="https" />
      </intent>
      <!-- If your app makes calls -->
      <intent>
        <action android:name="android.intent.action.DIAL" />
        <data android:scheme="tel" />
      </intent>
      <!-- If your sends SMS messages -->
      <intent>
        <action android:name="android.intent.action.SENDTO" />
        <data android:scheme="smsto" />
      </intent>
      <!-- If your app sends emails -->
      <intent>
        <action android:name="android.intent.action.SEND" />
        <data android:mimeType="*/*" />
      </intent>
    </queries>
    

    对于 IOS,将其添加到您的 Info.plist 文件中:

    <key>LSApplicationQueriesSchemes</key>
    <array>
      <string>https</string>
      <string>http</string>
    </array>
    

    注意:您需要停止并重新启动应用程序才能看到更改(在您的模拟器中)

    【讨论】:

      猜你喜欢
      • 2021-07-10
      • 2020-05-29
      • 1970-01-01
      • 2022-01-25
      • 2021-12-31
      • 2018-11-14
      • 2021-09-28
      • 1970-01-01
      • 2021-10-06
      相关资源
      最近更新 更多