繁体   English   中英

Flutter 错误:使用 url_launcher 插件时

[英]Flutter error: when using url_launcher plugin

Future<void> launchInBrowser(String url) async {
  Uri dir = Uri.parse(url);
  if (!await launchUrl(
    dir,
    mode: LaunchMode.externalApplication,
  )) {
    throw 'Could not launch $url';
  }
}

我正在使用 url_launcher 版本 6.1.6 flutter 插件,当我构建应用程序时出现此错误 flutter build is getting error with this: Could not load compiled classes for build file 'C:\src\flutter\flutter.pubcache\hosted\ pub.dartlang.org\url_launcher_android_6.0.21\android\build.gradle' 来自缓存 '''

  • 出了什么问题:配置项目“:flutter_plugin_android_lifecycle”时出现问题。

无法从缓存中加载构建文件 'C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\url_launcher_android_6.0.21\android\build.gradle' 的已编译类。 未能通知项目评估侦听器。 无法为类型为 org.gradle.api.Project 的项目“:url_launcher_android_6.0.21”获取未知属性“android”。 无法为类型为 org.gradle.api.Project 的项目“:url_launcher_android_6.0.21”获取未知属性“android”。 '''

我尝试删除 gradle 文件夹我是我的应用程序,还从主机文件夹中删除了插件,但没有任何效果。

flutter 医生-v output

[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19043.2251], locale en-US)
    • Flutter version 3.3.8 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 52b3dc25f6 (4 days ago), 2022-11-09 12:09:26 +0800
    • Engine revision 857bd6b74c
    • Dart version 2.18.4
    • DevTools version 2.15.0

Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at C:\Users\mo7ma\AppData\Local\Android\sdk
    • Platform android-33, build-tools 31.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.13)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
    • Visual Studio Build Tools 2019 version 16.11.32413.511
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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-7249189)

[√] VS Code (version 1.73.1)
    • VS Code at C:\Users\mo7ma\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.52.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19043.2251]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 107.0.5304.107
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 107.0.1418.35

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

您是否在 AndroidManifest.xml 文件中添加了以下内容?

<!-- Provide required visibility configuration for API level 30 and above -->
<queries>
  <!-- If your app checks for SMS support -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="sms" />
  </intent>
  <!-- If your app checks for call support -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="tel" />
  </intent>
</queries>

我收到一个 lint 错误,改用 foreach。 所以我玩了一下,这是最后一个 for 循环:

prayerRequestList.forEach(prayerReturnList.add); 

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM