🌱 planting ideas 🌱

Getting started with flutter on Apple M1

Download flutter_macos_2.2.0-stable.zip from https://flutter.dev/docs/get-started/install/macos

Codelab 1:
https://codelabs.developers.google.com/codelabs/first-flutter-app-pt1?utm_source=google-io21&utm_medium=referral&utm_campaign=io21-resources#0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
❯ flutter doctor

╔════════════════════════════════════════════════════════════════════════════╗
β•‘ Welcome to Flutter! - https://flutter.dev β•‘
β•‘ β•‘
β•‘ The Flutter tool uses Google Analytics to anonymously report feature usage β•‘
β•‘ statistics and basic crash reports. This data is used to help improve β•‘
β•‘ Flutter tools over time. β•‘
β•‘ β•‘
β•‘ Flutter tool analytics are not sent on the very first run. To disable β•‘
β•‘ reporting, type 'flutter config --no-analytics'. To display the current β•‘
β•‘ setting, type 'flutter config'. If you opt out of analytics, an opt-out β•‘
β•‘ event will be sent, and then no further information will be sent by the β•‘
β•‘ Flutter tool. β•‘
β•‘ β•‘
β•‘ By downloading the Flutter SDK, you agree to the Google Terms of Service. β•‘
β•‘ Note: The Google Privacy Policy describes how data is handled in this β•‘
β•‘ service. β•‘
β•‘ β•‘
β•‘ Moreover, Flutter includes the Dart SDK, which may send usage metrics and β•‘
β•‘ crash reports to Google. β•‘
β•‘ β•‘
β•‘ Read about data we send with crash reports: β•‘
β•‘ https://flutter.dev/docs/reference/crash-reporting β•‘
β•‘ β•‘
β•‘ See Google's privacy policy: β•‘
β•‘ https://policies.google.com/privacy β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•


Running "flutter pub get" in flutter_tools... 1,010ms
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel stable, 2.2.0, on macOS 11.2.2 20D80 darwin-arm, locale en-IN)
[βœ—] Android toolchain - develop for Android devices
βœ— Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.

[βœ—] 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 see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[βœ“] Chrome - develop for the web
[!] Android Studio (not installed)
[βœ“] VS Code (version 1.54.3)
[βœ“] Connected device (1 available)

! Doctor found issues in 3 categories.

From the above error you can see that Android studio and XCode are required and the links to download are provide. Download both of them and try running flutter doctor again.

Accepting android licenses

1
2
3
4
5
6
7
8
9
10
11
12
13
~/dev/startup_namer
❯ flutter doctor --android-licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 5 more

Android Studio doesn’t install Android Command Line tools by default. Follow the screenshots below:
image.png
Screenshot 20210519 at 9.08.29 PM.png
Screenshot 20210519 at 9.09.19 PM.png
Screenshot 20210519 at 9.09.31 PM.png
Screenshot 20210519 at 9.09.37 PM.png
Screenshot 20210519 at 9.10.35 PM.png

Now rerunning flutter doctor --android-licenses doesn’t throw any exception.