Today I am facing a problem that the third party dependencies package import intellisense did not work. This is a simple code, I am using get in flutter like this:
class WordProvider extends GetConnect {
}
this is the part of the dependencies define in my project:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
get: 4.3.8
as expect, the android studio should give me tips should import the package:get/get.dart after the mouse hang over the GetConnect, but it not give any import suggestion. I have tried:
File-> Ivalidate caches / Restart -> Invalidate and Restart
still did not work. This is my env information:
[dolphin#MiWiFi-R4CM-srv]~/Documents/GitHub/reddwarf-dict% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.2, on Fedora 32 (Workstation Edition) 5.11.22-100.fc32.x86_64, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
✗ Android SDK file not found: /home/dolphin/Android/Sdk/platforms/android-31/android.jar.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2)
[✓] VS Code (version 1.60.2)
[✓] Connected device (2 available)
! Doctor found issues in 1 category
why would this happen and what should I do to fix it? This is android studio version info:
Android Studio Arctic Fox | 2020.3.1 Patch 2
Build #AI-203.7717.56.2031.7678000, built on August 26, 2021
Runtime version: 11.0.10+0-b96-7249189 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.11.22-100.fc32.x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry: ide.instant.shutdown=false, external.system.auto.import.disabled=true
Non-Bundled Plugins: com.bakerj.flutter.fishreduxtemplate.id, com.bloc.intellij_generator_plugin, com.intellij.marketplace, Dart, com.thoughtworks.gauge, org.jetbrains.kotlin, io.flutter, org.intellij.plugins.markdown
Current Desktop: GNOME
Remove the dependency and run flutter clean and after that run:
flutter pub add get
Related
I am trying to execute a .gitlabci.yml file with Gitlab Runner.
But I am getting this error message.
No dependencies changed.
1 package is discontinued.
57 packages have newer versions incompatible with dependency constraints.
Try `dart pub outdated` for more information.
Running "flutter pub get" in tardis...
The current Flutter SDK version is 0.0.0-unknown.
Because newApp depends on workmanager >=0.2.3 which requires Flutter SDK version >=1.10.0, version solving failed.
In short gitlab runner cannot detect my flutter version.
My flutter doctor screen:
[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Version 10.0.19044.1766], locale tr-TR)
[√] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.1)
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.68.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
• No issues found!
How can i fix this?
Solved this problem. Perhaps, the GitLab runner cannot detect my flutter version because of the flutter SDK location. I moved the SDK from drive D to drive C and specified the new environment variable path. It works fine now.
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!
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 am running flutter doctor command. But it is saying android studio is not installed many times. I tried flutter config --android-studio-dir=/home/khamidjon/.android, and many more paths I tried to show but to no luck.
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[!] Android Studio
✗ android-studio-dir = /home/khamidjon/.android
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] Connected device (1 available)
! Doctor found issues in 1 category.
My question is what location should be shown for PATH in flutter config --android-studio-dir='PATH'?
For Android Studio installed with Flatpak, i found this config to work:
flutter config --android-studio-dir=/path/to/home/.local/share/flatpak/app/com.google.AndroidStudio/current/active/files/extra/android-studio
Where path/to/home is the path to your home directory.
(Ubuntu 21.10/Pop!_OS)
Snap packages are installed under /snap/appname/ with subdirectories for each new version. Try this to reslove the issue, it worked for me.
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
The current directory will make sure that it always points to the latest version.
if you have Androind Studio installed in your home directory /home/khamidjon set up PATH like this: /home/khamidjon/android-studio/bin
to append variable in Linux use command
export PATH=$PATH:/some/new/path
to check your PATH use
echo $PATH
In my case snap packages can retain old versions of the program. So inside /snap/android-studio There were 2 versions of android studio inside directories /snap/android-studio/99 and /snap/android-studio/100. So I showed one of these paths: directory /snap/android-studio/100/android-studio with latest version.
So I ran:
flutter config --android-studio-dir=/snap/android-studio/100/android-studio
flutter doctor
Result:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.1, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] IntelliJ IDEA Community Edition (version 2020.3)
[✓] Connected device (2 available)
• No issues found!
In windows
if your Android Studio install by default, you can use this command
flutter config --android-studio-dir="C:\Program Files\Android\Android Studio"
after this command, flutter can found android studio, but the plugin can't...
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.48.0)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
In Linux (Ubuntu)
Note: for those who are facing the problem in Ubuntu and Android Studio is installed with snap:
flutter config --android-studio-dir="/snap/android-studio/current/android-studio"
Note: for those who are facing the problem in Ubuntu and Android Studio is installed with JetBrains Toolbox:
flutter config --android-studio-dir=/home/myuser/.local/share/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882
Where ./201.7042822 matches the current version of Android Studio installed. You'll have to check which one you have and update it in the command above.
I use flutter to develop windows desktop programs, I installed visual studio 2019 enterprise, fully installed, more than 50G. I just installed the part that can change the path on the D drive. But after executing flutter doctor, why does the following prompt appear?
error:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel dev, 1.23.0-7.0.pre, on Microsoft Windows [Version 10.0.18363.1082], locale zh-CN)
[!] 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
[!] Visual Studio - develop for Windows (Visual Studio Enterprise 2019 16.0.0)
X The current Visual Studio installation is incomplete. Please reinstall Visual Studio.
[√] Android Studio (version 4.0)
[!] IntelliJ IDEA Community Edition (version 2019.3)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] IntelliJ IDEA Ultimate Edition (version 2018.1)
[√] Connected device (1 available)
! Doctor found issues in 3 categories.
That specific error message from doctor means that the vswhere tool is reporting false for the isComplete property. This means there is an issue with your Visual Studio installation (or at least, Microsoft's tooling believes there is).