Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter Mac Installation #13

Open
2 tasks done
nelsonic opened this issue Jan 10, 2020 · 21 comments
Open
2 tasks done

Flutter Mac Installation #13

nelsonic opened this issue Jan 10, 2020 · 21 comments
Labels
good first issue Good for newcomers

Comments

@nelsonic
Copy link
Member

nelsonic commented Jan 10, 2020

While attempting to download/install Flutter following the official instructions:
https://flutter.dev/docs/get-started/install/macos

I also had to download:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-GB)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on
        the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods
[!] Android Studio (version 3.5)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.41.1)
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
    ! No devices available

! Doctor found issues in 4 categories.

“Visual Studio Code” can’t be opened because Apple cannot check it for malicious software.
image
see: microsoft/vscode#74782 (open Settings > Security ... click on "Open Anyway")
visual-studio-code-open-anyway

[!] Android Studio (version 3.5)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
https://stackoverflow.com/questions/51860845/flutter-plugin-not-installed-error-when-running-flutter-doctor

After installing everything we have the following:

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-GB)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.41.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

https://stackoverflow.com/questions/49045393/flutter-run-no-connected-devices
https://flutter.dev/docs/get-started/install/macos#set-up-the-android-emulator

Open Android Studio and locate the drop-down that says no devices:
image
Click on "Open AVD Manager" (Android Virtual Device)
Screenshot 2020-01-10 at 17 45 29

You should see the following:
image

Select the API version: (click the download button)
image

That will download Android Q which is another 1.1Gb
image

@nelsonic nelsonic added the good first issue Good for newcomers label Jan 10, 2020
@nelsonic
Copy link
Member Author

Still getting:

[!] Connected device
    ! No devices available

https://stackoverflow.com/questions/44485848/android-sdk-cannot-be-found-by-flutter/51644461#51644461

flutter config --android-sdk /path/to/android/sdk

Had to go searching for these two paths ...
https://stackoverflow.com/questions/34532063/finding-android-sdk-on-mac-and-adding-to-path
In my case (on Mac)

flutter config --android-sdk ~/Library/Android/sdk

@nelsonic
Copy link
Member Author

Still getting

[!] Connected device
    ! No devices available

Ran:

flutter config --enable-web

Got:

Setting "enable-web" value to "true".

You may need to restart any open editors for them to read new settings.

Restarting my computer ...

@nelsonic
Copy link
Member Author

nelsonic commented Jan 10, 2020

-bash: flutter: command not found

https://stackoverflow.com/questions/46423088/flutter-run-command-not-working/49727202

export PATH=~/code/flutter/bin:$PATH;

Eventually ... after following: https://developer.android.com/studio/debug/dev-options#enable

[✓] Connected device (1 available)
    • Pixel 3 • 89HX09YMG • android-arm64 • Android 10 (API 29)

• No issues found!

@miguelmartins17
Copy link
Collaborator

@nelsonic Have you been able to come to any conclusions regarding the installation of the flutter on the Mac?

@nelsonic
Copy link
Member Author

@miguelmartins17 as per my comments above, I eventually figured out how to install everything and add my Android device. Did you install flutter on the MacBook Air? And if you did where did you document all the steps involved?

@miguelmartins17
Copy link
Collaborator

@nelsonic Since I've been working on putting the app on Google Play Store, I haven't installed Flutter on Mac yet.
I started working on the TodoList on Flutter.
And I've taken it all out documented when I get to some important point.

@miguelmartins17
Copy link
Collaborator

Did anyone have problems opening Visual Studio Code ?
If so, what was the solution?

image

@nelsonic
Copy link
Member Author

@miguelmartins17 I posted the solution to that yesterday (see above)
image

Open Settings > Security
Then click on "Open Anyway"
visual-studio-code-open-anyway

@miguelmartins17
Copy link
Collaborator

Am I Doing Something Wrong ?
Screen Shot 2020-01-11 at 16 02 23

@iteles
Copy link
Member

iteles commented Jan 11, 2020

@nelsonic I don't see a PR open for this but wanted to triple-check. Are you already putting this into a readme or shall I do it as I go?

@nelsonic
Copy link
Member Author

@iteles I'm very happy for someone else do the documentation for a change ... 🤔
Especially someone who recently received a Mac and is learning to develop cross-platform apps ... 😉

@miguelmartins17
Copy link
Collaborator

This should be documented the "installation of Flutter on Mac" is much more complex than windows just run Android Studio and install it from there. 😆

@nelsonic
Copy link
Member Author

@miguelmartins17 sounds like you have a perfect opportunity to learn how to use vi / vim on mac to edit your ~/.bash_profile file 😉 https://github.com/dwyl/learn-vim

e.g:

vi ~/.bash_profile

The reason for having multiple code editors on your computer is so that you can quickly switch between them if you have multiple projects open in different programming languages.
The reason for learning vi / vim is that it's the editor that comes with Linux/Unix and therefore if you are doing "server" or embedded systems work, you can always expect it to be available.

@miguelmartins17
Copy link
Collaborator

I ran that command and it turned out this was supposed to be Flutter's path.
Screen Shot 2020-01-11 at 16 26 08

@miguelmartins17
Copy link
Collaborator

@nelsonic You're right, all the information is welcome the more you learn the better.

@nelsonic
Copy link
Member Author

Rather than using Visual Studio Code, I'm using Android Studio (for now because it gives more info)
However there isn't an easy way to open
https://stackoverflow.com/questions/35363546/open-androidstudio-project-from-command-line-on-osx
Thanks to @gradyplayer and @pkeno we can add a simple shortcut to open Android Studio.
Edit your ~/.bash_profile file:

vi ~/.bash_profile

Once the file is open, add the following lines:

alias androidstudio="open -a /Applications/Android\ Studio.app"
alias as="open -a /Applications/Android\ Studio.app"

Save the file (press the Esc key and type :wq then hit the Enter key)

Restart your terminal/iTerm.
Now when you re-open Terminal/iTerm, you can type:

androidstudio .

That "full stop" means open the current directory (whichever directory you are in) in Android Studio.
Obviously I'm using the shorter version:

as .

@miguelmartins17
Copy link
Collaborator

@nelsonic I think I've made it even with the phone connected, no more errors.
Screen Shot 2020-01-12 at 12 06 20

@nelsonic
Copy link
Member Author

nelsonic commented Feb 8, 2020

Trying to install Flutter on MacBook Pro got:
image

Retrying ...

@nelsonic
Copy link
Member Author

nelsonic commented Feb 8, 2020

XCode ... another 7.5Gb ... I'm _lucky enough to have decent (unlimited) bandwidth.
image
I fell sorry for people who are on slow/metered connections, they are basically blocked from iOS Dev. 🤦‍♂

@nelsonic
Copy link
Member Author

nelsonic commented Feb 8, 2020

Got it working on Mac:
image

@gradyplayer
Copy link

Ha, I haven’t ever gotten a github mention for something I did on stackoverflow before, I am glad it helped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants