Fixing Mobile Tools when Flutter Doctor complains, V2

Fixing Mobile Tools when Flutter Doctor complains, V2

(This is an amendment to a previous article I published. New computer = new understanding of old problems as I go through them for a second time.)

I was recently tasked with setting up Flutter and Dart on a MacOS machine that already had the Android Studio UI installed on it. I am making these notes in case anyone should encounter similar difficulties (including myself, later on).

No alt text provided for this image

Above, you can see that running "flutter doctor -v" has produced a clean bill of health, except for issues with missing command lines and unaccepted licenses.

Step 1 -- Getting the Command Line Tools

I downloaded "Command Line Tools Only" (since I already had the UI) from this location.

You can go into Android Studio and choose "Project Structure" from the File menu to find where your SDK is currently located...

No alt text provided for this image

This bit is important, I had to take the contents of the ZIPped download and put it in a folder within the above location called cmdline-tools/latest ...

No alt text provided for this image

Step 2 -- Accepting the licenses

Once you've done this, you should do 2 things...

First, make sure that your cmdline-tools' bin directory is added to your path. Then, run "sdkmanager --licenses". Follow the prompts to review and approve all available licenses.

No alt text provided for this image

Step 3 -- Install CocoaPods (on Mac)

If you are using a Mac and get grief about not having CocoaPods, simply run "sudo gem install -n /usr/local/bin cocoapods".

Step 4 -- Link to a new location for Java

On a brand new install, you need to do a couple of things to tell Flutter where to find Java. First, you need to set your JAVA_HOME variable to point to "/Applications/Android Studio.app/Contents/jbr/Contents/Home". Second, you need to run the instructions below, because the latest Android Studio distributions put Java in the "jbr" folder and it is expected by Android in a "jre" folder.

cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre

Finally -- rerun the Doctor!

Now, when you run "flutter doctor -v", you should get output with nothing but green check marks next to it. You are fully installed and ready to go!

To view or add a comment, sign in

Others also viewed

Explore topics