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:srcflutterflutter.pubcachehostedpub.dartlang.orgurl_launcher_android_6.0.21androidbuild.gradle’ from cache
”’
- What went wrong:
A problem occurred configuring project ‘:flutter_plugin_android_lifecycle’.
Could not load compiled classes for build file ‘C:srcflutterflutter.pub-cachehostedpub.dartlang.orgurl_launcher_android_6.0.21androidbuild.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:srcflutter
• 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:Usersmo7maAppDataLocalAndroidsdk
• Platform android-33, build-tools 31.0.0
• Java binary at: C:Program FilesAndroidAndroid Studiojrebinjava
• 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 FilesGoogleChromeApplicationchrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.13)
• Visual Studio at C:Program Files (x86)Microsoft Visual Studio2019BuildTools
• 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 FilesAndroidAndroid 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:Usersmo7maAppDataLocalProgramsMicrosoft 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!
2
Answers
Did you add the following in your AndroidManifest.xml file?
I received a lint error to use foreach instead. So I played around with it, and this is the final for loop: