Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

Ultimate macOS Guide: Flutter + Android SDK

It covers Android SDK, Java (JDK), Flutter, Path wiring, Plugin setup, Validation, AVD/emulator, and creating a project—plus quick fixes.

Assumptions: default shell = zsh, Apple Silicon path (/opt/homebrew). If you’re on Intel, replace /opt/homebrew with /usr/local.


1) Install Java (JDK)

Most Android/Gradle stacks are happy with JDK 17+.

# Install (latest LTS). If you specifically want 17, use: brew install --cask temurin17
brew install --cask temurin

# Ensure JAVA_HOME is set automatically
echo 'export JAVA_HOME="$(/usr/libexec/java_home)"' >> ~/.zshrc
source ~/.zshrc

# Verify
java -version
Code language: PHP (php)

2) Install the Android SDK (CLI-only path, no GUI required)

If you prefer Android Studio GUI, install it via brew install --cask android-studio and use Preferences → Android SDK to install Command-line Tools, Platform-Tools, Build-Tools. Then skip to step 3.

2.1 Create SDK home and install command-line tools

# Set SDK root (mac default location)
echo 'export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"' >> ~/.zshrc
echo 'export ANDROID_HOME="$ANDROID_SDK_ROOT"' >> ~/.zshrc
source ~/.zshrc

# Create the folder
mkdir -p "$ANDROID_SDK_ROOT"

# Install Android command-line tools
brew install --cask android-commandlinetools
Code language: PHP (php)

2.2 Put tools where Flutter expects them

Flutter looks for sdkmanager at:
$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager

mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"

# Try the "latest" symlink first (preferred; auto-updates with brew)
rm -rf "$ANDROID_SDK_ROOT/cmdline-tools/latest"
ln -s "/opt/homebrew/Caskroom/android-commandlinetools/latest/cmdline-tools" \
      "$ANDROID_SDK_ROOT/cmdline-tools/latest" 2>/dev/null || true

# If your Caskroom doesn't have "latest", symlink the version you saw (example: 13114758)
if [ ! -x "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" ]; then
  ln -s "/opt/homebrew/Caskroom/android-commandlinetools/13114758/cmdline-tools" \
        "$ANDROID_SDK_ROOT/cmdline-tools/latest"
fi
Code language: PHP (php)

2.3 Add Android tools to PATH

# Add PATHs (platform-tools, emulator, cmdline-tools)
{
  echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools"'
  echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/emulator"'
  echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin"'
} >> ~/.zshrc
source ~/.zshrc

# Sanity checks
which sdkmanager
which adb
Code language: PHP (php)

2.4 Install core SDK components

# Avoid "repositories.cfg could not be loaded" warning
mkdir -p ~/.android && touch ~/.android/repositories.cfg

# Accept licenses (press y for each)
sdkmanager --licenses

# Core packages
sdkmanager "platform-tools" "emulator" "cmdline-tools;latest"

# Choose a modern Android platform + build-tools (adjust if needed)
sdkmanager "platforms;android-35" "build-tools;35.0.0"

# Optional: system image for an ARM64 emulator
sdkmanager "system-images;android-35;google_apis;arm64-v8a"
Code language: PHP (php)

3) Install Flutter (CLI)

brew install --cask flutter

# Put Flutter on PATH using the SDK’s own path (future-proof)
echo 'export PATH="$PATH:$(flutter sdk-path)/bin"' >> ~/.zshrc
source ~/.zshrc

# Verify
flutter --version
Code language: PHP (php)

4) Wire Flutter ↔ Android SDK & Validate

# (Only needed if Flutter doesn’t auto-detect your SDK)
flutter config --android-sdk "$ANDROID_SDK_ROOT"

# Accept Android licenses via Flutter
flutter doctor --android-licenses

# Full diagnostic
flutter doctor -v
Code language: PHP (php)

You should see green checks for:

  • Flutter
  • Android toolchain
  • Xcode (if installed)
  • IDEs (if detected)

5) Install Flutter plugins (IDEs)

Android Studio

  1. Preferences → Plugins → Marketplace
  2. Install Flutter (it auto-installs Dart)
  3. Restart Android Studio
  4. Preferences → Languages & Frameworks → Flutter → set Flutter SDK path (yours was: /opt/homebrew/share/flutter or use flutter sdk-path)

VS Code (optional)

  • Install Flutter and Dart extensions from the Marketplace.

6) Locate SDK paths quickly (for future prompts)

# Flutter SDK root
flutter sdk-path

# Android SDK root
echo $ANDROID_SDK_ROOT

# Where is sdkmanager/adb?
which sdkmanager
which adb
Code language: PHP (php)

7) Create and run a Flutter project

# Create
flutter create hello_app
cd hello_app

# List devices (emulators/phones)
flutter devices
Code language: PHP (php)
  • If you already created an AVD, start it: emulator -list-avds emulator -avd Pixel_8_API_35
  • Then run: flutter run

8) Create an Android emulator (AVD) from CLI (optional)

# Create a Pixel 8 AVD targeting android-35
avdmanager create avd -n Pixel_8_API_35 \
  -k "system-images;android-35;google_apis;arm64-v8a" -d pixel_8

# Start it
emulator -avd Pixel_8_API_35
Code language: PHP (php)

9) (Optional) iOS setup on macOS

If you want to run on iPhone simulators:

# Xcode CLTs
xcode-select --install || true

# First-run (may prompt)
sudo xcodebuild -runFirstLaunch

# (Sometimes license acceptance is interactive in GUI)
# Install CocoaPods for iOS deps
brew install cocoapods
pod setup

# Check again
flutter doctor -v
Code language: PHP (php)

10) Quick Troubleshooting (copy/paste fixes)

A. Android sdkmanager not found

# Ensure the file exists here:
ls "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager"

# Ensure PATH contains it
echo $PATH | tr ':' '\n' | grep cmdline-tools || \
echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin"' >> ~/.zshrc && source ~/.zshrc

# Reinstall / relink cmdline tools if missing
brew reinstall --cask android-commandlinetools
rm -rf "$ANDROID_SDK_ROOT/cmdline-tools/latest"
ln -s "/opt/homebrew/Caskroom/android-commandlinetools/latest/cmdline-tools" \
      "$ANDROID_SDK_ROOT/cmdline-tools/latest"
Code language: PHP (php)

B. cmdline-tools component is missing

sdkmanager "cmdline-tools;latest"
Code language: JavaScript (javascript)

C. Emulator not listed in flutter devices

emulator -list-avds
# If none, create one (see section 8), then:
emulator -avd Pixel_8_API_35
flutter devices
Code language: PHP (php)

D. License prompts keep appearing

yes | sdkmanager --licenses
flutter doctor --android-licenses

E. Wrong SDK path in Android Studio

  • Set Preferences → Languages & Frameworks → Flutter → Flutter SDK path to:
    • flutter sdk-path (paste the result), e.g. /opt/homebrew/share/flutter

F. Verify everything at once

echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT"
which sdkmanager && sdkmanager --list | head -n 30
adb version
java -version
which flutter && flutter --version
flutter doctor -v
Code language: PHP (php)

11) One-time setup script (save as setup_flutter_android_macos.sh)

Edit the versioned line (13114758) if your cask uses a different folder; the script also tries the latest alias.

#!/usr/bin/env bash
set -euo pipefail

# JDK
brew install --cask temurin || true

# SDK roots
grep -q 'ANDROID_SDK_ROOT=' ~/.zshrc || echo 'export ANDROID_SDK_ROOT="$HOME/Library/Android/sdk"' >> ~/.zshrc
grep -q 'ANDROID_HOME=' ~/.zshrc || echo 'export ANDROID_HOME="$ANDROID_SDK_ROOT"' >> ~/.zshrc
source ~/.zshrc

mkdir -p "$ANDROID_SDK_ROOT"

# Android command-line tools
brew install --cask android-commandlinetools || true
mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools"
rm -rf "$ANDROID_SDK_ROOT/cmdline-tools/latest"
ln -s "/opt/homebrew/Caskroom/android-commandlinetools/latest/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest" \
  || ln -s "/opt/homebrew/Caskroom/android-commandlinetools/13114758/cmdline-tools" "$ANDROID_SDK_ROOT/cmdline-tools/latest"

# PATHs
grep -q 'platform-tools' ~/.zshrc || echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools"' >> ~/.zshrc
grep -q 'emulator' ~/.zshrc || echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/emulator"' >> ~/.zshrc
grep -q 'cmdline-tools/latest/bin' ~/.zshrc || echo 'export PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin"' >> ~/.zshrc
source ~/.zshrc

# Accept licenses & core packages
mkdir -p ~/.android && touch ~/.android/repositories.cfg
yes | sdkmanager --licenses || true
sdkmanager "platform-tools" "emulator" "cmdline-tools;latest" \
           "platforms;android-35" "build-tools;35.0.0" || true

# Flutter
brew install --cask flutter || true
grep -q 'flutter sdk-path' ~/.zshrc || echo 'export PATH="$PATH:$(flutter sdk-path)/bin"' >> ~/.zshrc
source ~/.zshrc

# Final check
flutter doctor -v
echo "Done. If Android Studio is installed, add the Flutter plugin and set Flutter SDK path to: $(flutter sdk-path)"
Code language: PHP (php)

Run it:

chmod +x setup_flutter_android_macos.sh
./setup_flutter_android_macos.sh

12) Short checklist (what “green” looks like)

  • java -version → prints Temurin/Oracle/OpenJDK
  • which sdkmanager → points to $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager
  • adb version → prints version
  • flutter --version → prints 3.35.x
  • flutter doctor -v → Android toolchain ✅
  • Android Studio → Plugins: Flutter + Dart, Flutter SDK path set
  • flutter create app && cd app && flutter run → launches on emulator/device

That’s it. Save this guide and the script; next time it’s a one-shot setup with predictable results.

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x