title: Downloading Android toolchain to work with Flutter without Android Studio
body: <p>I'm doing fresh install at McBook air, and wanted to work with Flutter at Android without Android Studio, so I did the below:</p>
  
  <p>I downloaded <code>flutter-sdk</code> and added it to the permeant path as:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ sudo code $HOME/.bash_profile
  </code></pre>
  
  <p>Adding:</p>
  
  <pre><code>PATH=$PATH:/usr/local/Cellar/flutter/bin
  </code></pre>
  
  <p>Then, saving the file, and running:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ source $HOME/.bash_profile
  </code></pre>
  
  <p>And it was confirmed to be added by running:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ echo $PATH
  </code></pre>
  
  <p>Installed <code>android-sdk</code>:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ brew cask install android-sdk
  ==&gt; Caveats
  You can control android sdk packages via the sdkmanager command.
  You may want to add to your profile:
  
    'export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"'
  
  android-sdk requires Java 8. You can install it with
  
    brew cask install homebrew/cask-versions/java8
  
  ==&gt; Satisfying dependencies
  ==&gt; Downloading https://dl.google.com/android/repository/sdk-tools-darwin-433379
  ######################################################################## 100.0%
  ==&gt; Verifying SHA-256 checksum for Cask 'android-sdk'.
  ==&gt; Installing Cask android-sdk
  ==&gt; Linking Binary 'android' to '/usr/local/bin/android'.
  ==&gt; Linking Binary 'archquery' to '/usr/local/bin/archquery'.
  ==&gt; Linking Binary 'avdmanager' to '/usr/local/bin/avdmanager'.
  ==&gt; Linking Binary 'jobb' to '/usr/local/bin/jobb'.
  ==&gt; Linking Binary 'lint' to '/usr/local/bin/lint'.
  ==&gt; Linking Binary 'monkeyrunner' to '/usr/local/bin/monkeyrunner'.
  ==&gt; Linking Binary 'screenshot2' to '/usr/local/bin/screenshot2'.
  ==&gt; Linking Binary 'sdkmanager' to '/usr/local/bin/sdkmanager'.
  ==&gt; Linking Binary 'uiautomatorviewer' to '/usr/local/bin/uiautomatorviewer'.
  ==&gt; Linking Binary 'mksdcard' to '/usr/local/bin/mksdcard'.
  ==&gt; Linking Binary 'monitor' to '/usr/local/bin/monitor'.
    android-sdk was successfully installed!
  Hasans-Air:~ h_ajsf$ 
  </code></pre>
  
  <p>And added <code>Anroid-SDK_ROOT</code> as requisted above:</p>
  
  <pre><code>export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
  </code></pre>
  
  <p>Installed <code>Platform-tools</code>:</p>
  
  <pre><code>Last login: Sat Nov 10 14:13:29 on ttys002
  Hasans-Air:~ h_ajsf$ brew cask install android-platform-tools
  ==&gt; Satisfying dependencies
  ==&gt; Downloading https://dl.google.com/android/repository/platform-tools_r28.0.1-
  ######################################################################## 100.0%
  ==&gt; Verifying SHA-256 checksum for Cask 'android-platform-tools'.
  ==&gt; Installing Cask android-platform-tools
  ==&gt; Linking Binary 'adb' to '/usr/local/bin/adb'.
  ==&gt; Linking Binary 'dmtracedump' to '/usr/local/bin/dmtracedump'.
  ==&gt; Linking Binary 'etc1tool' to '/usr/local/bin/etc1tool'.
  ==&gt; Linking Binary 'fastboot' to '/usr/local/bin/fastboot'.
  ==&gt; Linking Binary 'hprof-conv' to '/usr/local/bin/hprof-conv'.
  ==&gt; Linking Binary 'mke2fs' to '/usr/local/bin/mke2fs'.
    android-platform-tools was successfully installed!
  Hasans-Air:~ h_ajsf$ 
  </code></pre>
  
  <p>I already installed <code>OpenJDK</code>:</p>
  
  <pre><code>$ brew cask install java
  </code></pre>
  
  <p>And Added <code>JAVA_HOME</code> by:</p>
  
  <pre><code>$ sudo code $HOME/.bash_profile
  </code></pre>
  
  <p>Adding line:</p>
  
  <pre><code>export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands
  </code></pre>
  
  <p>So that my <code>$HOME/.bash_profile</code> became as:</p>
  
  <pre><code>PATH=$PATH:/usr/local/Cellar/flutter/bin
  export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands
  </code></pre>
  
  <p>Then run:</p>
  
  <pre><code>$ source $HOME/.bash_profile
  </code></pre>
  
  <p>And confirmed the addition by:</p>
  
  <pre><code>Hasans-Air:lib h_ajsf$ echo $JAVA_HOME
  /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands
  </code></pre>
  
  <p>As well as <code>Gradle</code>:</p>
  
  <pre><code>$ brew install gradle
  </code></pre>
  
  <p>And installed <code>VS code</code> as:</p>
  
  <pre><code>$ brew cask install visual-studio-code
  </code></pre>
  
  <p>While checking with <code>flutter doctor</code>, I got the below:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ flutter doctor
  Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel beta, v0.8.2, on Mac OS X 10.14.1 18B75, locale en-SA)
  [!] Android toolchain - develop for Android devices
      ✗ Android SDK is missing command line tools; download from 
  </code></pre>
  
  <p>When I run the command <code>env</code>, I get the below:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ env
  TERM_PROGRAM=Apple_Terminal
  SHELL=/bin/bash
  TERM=xterm-256color
  TMPDIR=/var/folders/_k/x16061cd4rj7sj1z0fkcqghw0000gn/T/
  Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.bX9BTj1wQC/Render
  TERM_PROGRAM_VERSION=421.1
  TERM_SESSION_ID=C2B37969-41A9-467F-83E4-7E3DAC126B6F
  USER=h_ajsf
  SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.48dHTxJRcg/Listeners
  PATH=/usr/local/Cellar/flutter/bin:/Users/h_ajsf/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/tools:/tools:/platform-tools:/platform-tools
  PWD=/Users/h_ajsf
  
  
  JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands
  XPC_FLAGS=0x0
  XPC_SERVICE_NAME=0
  SHLVL=1
  HOME=/Users/h_ajsf
  LOGNAME=h_ajsf
  LC_CTYPE=UTF-8
  _=/usr/bin/env
  Hasans-Air:~ h_ajsf$ 
  </code></pre>
  
  <p>When I check for the variables, I get the below:</p>
  
  <pre><code>Hasans-Air:~ h_ajsf$ /usr/libexec/java_home
  /Library/Java/JavaVirtualMachines/openjdk-11.0.1.jdk/Contents/Home
  Hasans-Air:~ h_ajsf$ /usr/libexec/android_home
  -bash: /usr/libexec/android_home: No such file or directory
  Hasans-Air:~ h_ajsf$ /usr/libexec/android_sdk_root
  -bash: /usr/libexec/android_sdk_root: No such file or directory
  Hasans-Air:~ h_ajsf$ 
  </code></pre>
  
  <p><strong>My Question</strong> is:
  Where is the mistake I did, why it is saying <code>Android SDK missing command tool</code>, and how to fix it"?</p>