[英]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' 來自緩存 '''
無法從緩存中加載構建文件 '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.