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

I am using url_launcher version 6.1.6 flutter plugin and when I build the app I get this error 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' from cache '''

  • What went wrong: A problem occurred configuring project ':flutter_plugin_android_lifecycle'.

Could not load compiled classes for build file 'C:\src\flutter\flutter.pub-cache\hosted\pub.dartlang.org\url_launcher_android_6.0.21\android\build.gradle' from cache. Failed to notify project evaluation listener. Could not get unknown property 'android' for project ':url_launcher_android_6.0.21' of type org.gradle.api.Project. Could not get unknown property 'android' for project ':url_launcher_android_6.0.21' of type org.gradle.api.Project. '''

I tried deleting .gradle folder I'm my app , and also deleted the plugin from host folder , nothing works.

flutter doctor -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!

6
  • Can you include the link and the way you are launching the url on code-snippet Commented Nov 12, 2022 at 16:38
  • ` Future<void> launchInBrowser(String url) async { Uri dir = Uri.parse(url); if (!await launchUrl( dir, mode: LaunchMode.externalApplication, )) { throw 'Could not launch $url'; } } ` Commented Nov 12, 2022 at 16:57
  • Can you try flutter clean and rebuild the app. + make sure to follow install guide Commented Nov 12, 2022 at 17:18
  • Does this answer your question? Can not open my Url in flutter with Url_launcher Commented Nov 12, 2022 at 17:52
  • check this answer stackoverflow.com/questions/74336398/… Commented Nov 12, 2022 at 17:52

2 Answers 2

0

Did you add the following in your AndroidManifest.xml file?

<!-- 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>
Sign up to request clarification or add additional context in comments.

1 Comment

yes I also added it, but forgot to mention
0

I received a lint error to use foreach instead. So I played around with it, and this is the final for loop:

prayerRequestList.forEach(prayerReturnList.add); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.