I am trying to create icons for my app using flutter_launcher_icons, with options defined in pubspec.yaml. When I run flutter pub run flutter_launcher_icons:main, I get the following error:
Unable to spawn isolate: error: Library 'file:///Users/cameron/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_launcher_icons-0.9.0/bin/main.dart' was compiled with sound null safety (in strong mode) and it requires --sound-null-safety option at runtime
pub finished with exit code 1
Even if I pass in --sound-null-safety, the error persists (I also tried '--no-sound-null-safety' which also did nothing).
To check it wasn't a configuration error, I ran flutter create <name>, added flutter_launcher_icons: to dev dependencies (and flutter pub get), ran the same command and got the same error.
I am on Flutter 2.2, and I depend on integration_test, so I can't downgrade to a pre-null-safety version of flutter_launcher_icons, because those versions have transitive dependencies that conflict with integration_test from sdk.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.4)
[✓] VS Code (version 1.57.1)
[✓] Connected device (2 available)
• No issues found!
Related
In VSCode and trying to run the following:
dart pub upgrade
I get the following error:
Error: Error when reading 'pub': No such file or directory
However, my flutter file seems fine. Flutter Doctor output below:
[✓] Flutter (Channel stable, 3.3.4, on macOS 12.6 21G115 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.72.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
Any idea how I can resolve this? Thanks!
first clean dart using dart pub cache clean
then run dart pub get
After that run dart pub get upgrade
try creating a .bashrc file in your user's folder.
Then add the following:
PATH=$PATH:/path/to/dart/installation/bin/folder
export PATH
This can happen when you have installed Dart-sdk two times. One time as a windows installer, and the other through chocolatey for instance. Uninstall the one you have in "Add/Remove programs", or at least make sure you only have one, and it should work.
Today when I compile my flutter project, the OS is macOS Big Sur, shows error like this:
../../../.pub-cache/hosted/mirrors.tuna.tsinghua.edu.cn%2547dart-pub/riverpod-1.0.0-dev.10/lib/src/async_value_converters.dart:223:39: Error: The method 'ignore' isn't defined for the class 'Future<State>'.
- 'Future' is from 'dart:async'.
Try correcting the name to the name of an existing method, or defining a method named 'ignore'.
loadingCompleter!.future..ignore(),
^^^^^^
I am using the riverpod dependencies like this:
hooks_riverpod: ^1.0.0-dev.6
This problem was the first time to occurred. what should I do to fix this problem? This is the flutter environment info:
$ ~/apps/flutter/bin/flutter doctor ‹ruby-2.7.2›
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.2.3 20D91 darwin-x64, locale en-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[!] Android Studio (version 2020.3)
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.2)
[✓] VS Code (version 1.60.2)
[✓] Connected device (3 available)
! Error: xiaoqiang 的 iPhone is not connected. Xcode will continue when xiaoqiang 的 iPhone is connected. (code -13)
! Doctor found issues in 1 category.
(base)
I force the project to using a lower version of riverpod fix this problem:
riverpod: 1.0.0-dev.6
output of flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.2, on Linux, locale en_GB.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.56.2)
[✓] Connected device (2 available)
• No issues found!
After i did dart pub upgrade ...i got the following..
output of --stacktrace
I was getting the same error and I tried
flutter clean
and then
dart pub upgrade
for the Dependencies upgrade.
and then it started working you can just click on the Pub Upgrade in Android studio in pubspec.yml file of your projects.
Or you can remove the dependency which is creating issue after upgarde.
I am trying to migrate my Flutter/Dart project to use null safety. I have updated all of my dependencies and changed the sdk to use ">=2.12.0 <3.0.0". However, when I try to use the migration tool I get the following error:
When I look at my flutter and dart versions everything seems fine. I may be looking at it wrong, but below is the output from flutter doctor and brew info dart:
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.4 20F71 darwin-x64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --
android-licenses
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.57.0)
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
% brew info dart
dart-lang/dart/dart: stable 2.12.4, HEAD
The Dart SDK
https://dart.dev
Conflicts with:
dart-beta (because dart-beta ships the same binaries)
/usr/local/Cellar/dart/2.9.3 (509 files, 523.7MB) *
Built from source on 2020-09-14 at 16:52:16
From: https://github.com/dart-lang/homebrew-dart/blob/HEAD/dart.rb
==> Options
--HEAD
Install HEAD version
==> Caveats
Please note the path to the Dart SDK:
/usr/local/opt/dart/libexec
I'm suspecting that maybe I don't have the latest dart sdk like I believe I do. If that's the case then how do I upgrade without breaking anything?
UPDATE:
It appears I am using the latest version of dart. Going into the settings in Android Studio I can see it is pointing at the dart sdk that ships with flutter:
Have you run "flutter upgrade" in your terminal?
I've recently updated Flutter to 1.25.0-8.1.pre in beta. I could run debug apk and build release. But, the release-apk doesn't work and it stuck on default splash screen. Where the problem lies in. Is there any such bug from Flutter?
flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, 1.25.0-8.1.pre, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] VS Code (version 1.52.1)
[✓] Connected device (3 available)
• No issues found!
I just downgrade the flutter version to 1.24.0-10.2.pre which released on 11/19/2020 and retried building release apk. And it worked fine. Actually the problem lies with Flutter new update on beta. The corresponding issue : https://github.com/flutter/flutter/issues/72705