Posted on Leave a comment

How to run CocoaPods on Apple Silicon (M1)

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

2021 Solution

# STEP 1: Install ffi
sudo arch -x86_64 gem install ffi

# STEP 2: Re-install dependencies
arch -x86_64 pod install

Additional Information

#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 .zshrc or .bash_profile might be handy. Thanks, @theMoonlitKnight for the suggestion.

alias pod='arch -x86_64 pod'
Posted on Leave a comment

I am getting error “cmdline-tools component is missing” after installing Flutter and Android Studio… I added the Android SDK. How can I solve them?

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).

or

  1. Open SDK Manager from your Android Studio.
  2. SDK Tools tab
  3. Check Android SDK Command Line Tools as in the picture
  4. Apply.
  5. Then again run flutter doctor.
Posted on Leave a comment

Flutter doctor error – Android sdkmanager tool not found. Windows

Just like you, I have Android Studio installed, the key is to install Android SDK Command-line Tools, steps being:

  1. Open Android Studio
  2. Tools Menu, SDK Manager
  3. In the window that comes up there are inner panels, choose SDK Tools panel
  4. Tick Android SDK Command-line Tools
  5. 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.

Posted on Leave a comment

flutter doctor –android-licenses gives a java error

Installing Android SDK Command-line tools from Android SDK Manager did the job for me.

  1. Open Tools > SDK Manager
  2. From the left choose, Appearance & Behavior > System Settings > Android SDK
  3. Select SDK Tools from the top menu
  4. 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 WindowsLinux 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.

Posted on Leave a comment

Android Studio (not installed) , when run flutter doctor while Android Studio installed on machine

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.

Posted on Leave a comment

Flutter command not found

You need to correctly set up your Flutter path.

From macOS install – Update your path:

  1. Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
  2. 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.
  3. 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: export PATH=~/Documents/flutter/bin:$PATH
  4. Press Ctrl + X and when it asks you to save the file, choose Yes
  5. Run source $HOME/.bash_profile to refresh the current window or restart the terminal
  6. 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 ~/.bash_profile.

For zsh:

  1. Open Terminal
  2. Run: nano ~/.zshrc
  3. Add: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
  4. Run: source ~/.zshrc
  5. restart terminal
  6. Run: flutter doctor -v

For example : if flutter in your machine has been installed under [your_username]/Developer/flutter

export PATH=Developer/flutter/bin:$PATH