Download Flutter

  • We use AS for configuration, Flutter website

1.1 download SDK from the official website

1.1.1. Select the system

1.1.2 enter the download link

1.1.3. Click to download the latest ZIP package

1.1.4 Download and automatically decompress into a folder named “Flutter”, the next installation path
  • Because the Flutter SDK includes many command-line tools. We need to configure the environment variables, so we recommend that you install the command line tools where you normally put them! There are two common locations, one is the home directory: (if there is no home directory that can be set to display in preferences) ~/flutter:

The other is the /opt directory (hide files, command + shift +). Setting display) :

Copy the decompressed FOLDERS into folders folders

Compare the two directories
  • Home directory is suitable for a person to develop, no trouble permissions, /opt directory is suitable for a computer with multiple users, switching different users can access

1.2 Environment Configuration

  • When the flutter is running, you need to download the required resources from the official website. If you don’t have a ladder, you will need a mirror server (upload foreign resources to your local server), otherwise the download will be slow
1.2.1. Check the Shell environment
  • $ echo $SHELL
    Copy the code

1.2.2, come to your counterpartshellConfiguration file to configure
  • bashEnvironment:~/.bash_profile
  • zsh(The default for new Mac OS is ZSH) :~/.zshrc
  • If there is azsh: permission deniedProblem: Execute firstchmod +x ~/.zshrcTo give permission
1.2.3. Configuring a Mirror
  • If this parameter is not specified, the default address is accessed
    Export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cnCopy the code
1.2.4. Configure the Flutter environment variables
  • theFlutterThe command line tool path configuration, again in the previous stepshellWhen the terminal is closed and then opened, the operation of flutter will appear:command not found: flutterPerform this step to find the Flutter again.
    Export Flutter =/opt/ Flutter /bin export PATH=$Flutter :$PATHCopy the code
  • After the configuration is complete, save and close the configuration file and run the following command on the terminal:Load the configuration for it to take effect.If you arebashThe environmentbashThe configuration file of.
  • source ~/.zshrc
    Copy the code

2. Install Android Studio

2.1,websitedownload

2.2. Configure the SDK

  • command + ,You can go to preferences

2.3. Install the AS plug-in

  • Plug-in Library DownloadFlutter, installation along with installationDart

2.4. Solve the license problem

  • $ flutter doctor --android-licenses

2.5. Check whether the flutter environment passes

  • $ flutter doctor
    Copy the code
  • Some problems may arise:
2.5.1、cmdline-tools component is missing

  • Solution :(you can go to this path to see what is available)
  • / Users/username/Library/Android/SDK/tools/bin/sdkmanager - install "cmdline - the tools; latest"Copy the code
2.5.2, Android SDK not found at this location.

  • The solutionIn:Android StudioYou can configure the SDK path to flutter, and thenThen follow the steps to resolve the problem with the license$ flutter doctor --android-licenses.
  • $flutter config --android-sdk /Users/ username /Library/ android/SDKCopy the code

2.5.3. Unable to locate Android SDK

  • Solution: See 2.5.2

2.6. Install the Nighthian simulator

  • You’ll see it once you’ve installed it

2.7. Solve Gradle stuck problem

  • The first time you run it, you’ll find it stuck in the following place becauseGradletheMavenWarehouse abroad, stuck in this sentence:
  • Running Gradle task 'assembleDebug'
    Copy the code
  • The solution: modifyprojectUnder thebuild.gradleFiles andFlutter Installation DirectoryIn theflutter.gradlefile
    • build.gradle:
      • File path: Project -> Android -> build.gradle
      • Modified content: Findbuildscript 和 allprojectsTo the insidegoogle() 和 jcenter()(The new version ismavenCentral()) comment out, add ali cloud mirror.
        maven { url 'https://maven.aliyun.com/repository/google' } 
        maven { url 'https://maven.aliyun.com/repository/jcenter' } 
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
        Copy the code

    • flutter.gradle:
      • Path to the file: / opt/flutter/packages/flutter_tools gradle/flutter. Gradle
      • Modified contents:buildscriptJoin Ali Mirror

2.8, Unable to find bundled Java version

  • If you run into problems with Unable to find Bundled Java version during installation or upgrade, first check to see if your Mac is bundled with Java. If not, install it first, and if it is bundled, report the following error. There is probably a mismatch between Android Studio and the Flutter versions