2022 Nov Update
If you can use Homebrew to manage cocoapods.
# Uninstall the local cocoapods gem
sudo gem uninstall cocoapods
# Reinstall cocoapods via Homebrew
brew install cocoapods
# STEP 1: Install ffi
sudo arch -x86_64 gem install ffi
# STEP 2: Re-install dependencies
arch -x86_64 pod install
#1 For anyone seeing the
arch: posix_spawnp: gem: Bad CPU type in executable error, you must first install Rosetta. Thanks, @Jack Dewhurst
#2 If you run
pod commands pretty often, setting up an alias in
.bash_profile might be handy. Thanks, @theMoonlitKnight for the suggestion.
alias pod='arch -x86_64 pod'
The solution for me was opening Android Studio and going to SDK Manager, switch to the SDK Tools tab and check Android SDK Command-line Tools (latest).
- Open SDK Manager from your Android Studio.
- SDK Tools tab
- Check Android SDK Command Line Tools as in the picture
- Then again run
Just like you, I have Android Studio installed, the key is to install Android SDK Command-line Tools, steps being:
- Open Android Studio
- Tools Menu, SDK Manager
- In the window that comes up there are inner panels, choose SDK Tools panel
- Tick Android SDK Command-line Tools
- Choose Apply button near the bottom of the window
At that point, you will be prompted to accept the SDK license and the command line tools will be installed. Your license issue should now be resolved.
FYI, the command line tools will add a new folder
cmdline-tools inside your SDK Folder. If you look in there cmdline-tools/latest/bin you will see sdkmanager – but your license issue should already be resolved.
Installing Android SDK Command-line tools from Android SDK Manager did the job for me.
- Open Tools > SDK Manager
- From the left choose, Appearance & Behavior > System Settings > Android SDK
- Select SDK Tools from the top menu
- Check Android SDK Command-line tools and click ‘apply’.
Alternative to step #1: WINDOWS: File > Settings (Ctrl+Alt+S) / MAC : Android Studio > Preferences
This fix works for Windows, Linux and Mac OS X.
If you are facing a problem in spite of the above steps, you can try upgrading your system to JDK 8. Official documentation of upgrading to JDK 8 is available here.
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…
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
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
./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.
In my case, the following command in Terminal helped (as suggested by Günter Zöchbauer’s comment):
killall -9 dart
On Windows, run the following in a Command Prompt or PowerShell window (as suggested by upupming’s comment):
taskkill /F /IM dart.exe
(You can read about taskkill flags in Windows here)
You need to correctly set up your Flutter path.
From macOS install – Update your path:
- Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
- Open (or create)
$HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing
nano ~/.bash_profilemacOS v10.15 (Catalina) uses the Z shell by default, so edit $file HOME/.zshrc.If you are using a different shell, the file path and filename will be different on your machine.
- Add the following line and change
[PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s Git repository is:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH For example:
- Press Ctrl + X and when it asks you to save the file, choose Yes
source $HOME/.bash_profile to refresh the current window or restart the terminal
- Verify that the
flutter/bin directory is now in your PATH by running:
echo $PATH Notice that
[PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed Flutter SDK, not the location of your app
Instead of nano, you can use any text editor to edit file
- Open Terminal
- restart terminal
flutter doctor -v
For example : if flutter in your machine has been installed under [your_username]/Developer/flutter
If you have the flutter SDK installed.
flutter doctor -v
The first line will show the install path..
(if you don’t have it installed go to the documentation)