简体   繁体   English

错误:url_launcher 上的 flutter/runtime/dart_vm_initializer.cc(41)

[英]ERROR:flutter/runtime/dart_vm_initializer.cc(41) on url_launcher

I use HTTP launcher and found this error on my console log after I run debug on my android studio emulator:在我的 android studio 模拟器上运行调试后,我使用 HTTP 启动器并在我的控制台日志中发现了这个错误:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher_android) [错误:flutter/runtime/dart_vm_initializer.cc(41)] 未处理的异常:MissingPluginException(未在通道 plugins.flutter.io/url_launcher_android 上找到方法启动的实现)

This is the code where it throw error:这是它抛出错误的代码:

Future<void> _launchMap() async {
    final url = widget.website;
    var uri = Uri.parse(url);
    if (!await launchUrl(uri)) {
      throw 'Could not launch';
    }
  }

this is my android manifest:这是我的安卓清单:

       <queries>
            <!-- If your app checks for call support -->
            <intent>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="tel" />
            </intent>
            <intent>
                <action android:name="android.intent.action.VIEW" />
                <data android:scheme="https" />
            </intent>
        </queries>

I use the newest flutter version and I already follow the guide from https://pub.dev/packages/url_launcher , but it still can't direct the link that I want from my API我使用最新的 flutter 版本并且我已经按照https://pub.dev/packages/url_launcher中的指南进行操作,但它仍然无法从我的 API 中定向我想要的链接

If you are using hot restart or hot reload, it won't do the trick.如果您使用的是热重启或热重载,则无法解决问题。 Since Flutter has to inject plugin dependencies into the platform-specific parts of your app, hot restart/hot reload is not enough to trigger the injection.由于 Flutter 必须将插件依赖项注入应用程序的特定平台部分,因此热重启/热重载不足以触发注入。 Check this issue for more.检查此问题以获取更多信息。

Close the app and execute flutter run command.关闭应用程序并执行flutter run命令。

Try the following code:试试下面的代码:

Future<void> _launchMap() async {
       final url = widget.website;
       var uri = Uri.parse(url);
    if (await canLaunchUrl(url)) {
       await launchUrl(url);
   } else {
       throw 'Could not launch $url';
}}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:flutter/runtime/dart_vm_initializer.cc(41) 未处理的异常:类型“String”不是 json 文件的“index”类型“int”的子类型,flutter - ERROR:flutter/runtime/dart_vm_initializer.cc(41) Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index' for json file ,flutter [错误:flutter/runtime/dart_vm_initializer.cc(41) 未处理的异常:空检查运算符用于空值 - [ERROR:flutter/runtime/dart_vm_initializer.cc(41) Unhandled Exception: Null check operator used on a null value “[错误:flutter/runtime/dart_vm_initializer.cc(41)] 未处理的异常:类型&#39;未来<File> &#39; 不是类型“文件?”的子类型在类型转换中“错误 - "[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Future<File>' is not a subtype of type 'File?' in type cast" Error 错误:flutter/runtime/dart_vm_initializer.cc(41)] 未处理的异常:类型“String”不是类型“Map”的子类型<string, dynamic></string,> - ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'String' is not a subtype of type 'Map<String, dynamic> 如何解决 [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String' - how to solve [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String' 颤振错误 url_launcher 不工作 - error in flutter the url_launcher is not working 使用 URL_Launcher 包的 Flutter 错误 - Error on Flutter with the URL_Launcher package 颤振:url_launcher 异常 - Flutter : url_launcher exception FLUTTER:url_launcher 库和 Android Package 可见性错误 - FLUTTER: url_launcher library and Android Package Visibility error Flutter url_launcher 有多个电话号码 - Flutter url_launcher with multiple phone numbers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM