Related software Installation

The JDK installation

  • download

To download the installation package download page: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Download the 8.x version, those above 8 will have problems

  • The installation

Double-click the installation package and proceed to Finish

  • configuration

Find the JDK installation path, a version of the situation is: / Library/Java/JavaVirtualMachines/JDK – 8. The JDK/Contents/Home

You can also go to Access and select “Go” – “Computer”, then go to “Macintosh HD” – “Libraries” to see if there is a Java folder, and then find the installation path.

Check whether the. Bash_profile file exists in the user folder. If it does not, create it.

Add the following code to the.bash_profile file

JAVA_HOME = / Library/Java/JavaVirtualMachines/JDK - 10.0.1. JDK/Contents/Home PATH =$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
Copy the code

Enter the following command on the terminal for the configuration to take effect

source ~/.bash_profile
Copy the code

Run the following command to check whether the configuration is successful. If yes, the configuration path is displayed

echo $JAVA_HOME
Copy the code

Android Studio installation

  • download

Directly to the download page to download the installation package: https://developer.android.com/studio/ or click on the download the Android Studio v3.1.3 in website, please download, avoid XcodeGhost similar issues

  • The installation

Double-click the installation package and drag the application to “Applications” to complete the installation.

  • configuration

After the installation is complete, open the Android Studio app. The first time I open it, I will ask whether to import the Settings. According to the requirements, I am the first user, AND I choose the second option.

If you use it for the first time, it will pop out that you cannot access the Android SDK, so temporarily click Cancel.

Then click the blue button on the interface.

The final step is to download the relevant resources, and when you’re done, you’re ready to go to Android Studio.

Put the following code in.bash_profile

export ANDROID_HOME=/Users/mingyu/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
Copy the code

To install the plugin, open Android Studio and install all the plugin folders, including Flutter and Dart, in [home] – [Configure] – [Plugins].

Xcode installation

Install by searching for Xcode in the App Store

VSCode installation

To develop the IDE, go to the official website to download it. After installing Dart and Flutter, you need to install two extensions.

The Brew installation

The package management tool that flutter must use to install some packages.

Go to the official website and follow the latest tips to install; After the installation, you can choose to use the domestic image, open the terminal, and run the following command:

# reference documentation: https://mirror.tuna.tsinghua.edu.cn/help/homebrew/

cd /usr/local/Homebrew

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

brew update
# update takes a long time
Copy the code

Flutter installation

  • download

Run the following command to download the latest flutter code

git clone -b beta https://github.com/flutter/flutter.git
Copy the code
  • Installation & Configuration

Find the.bash_profile file in the user folder and create one if you don’t have one.

Add the following code to the file:

export PUB_HOSTED_URL=https://pub.flutter-io.cn # Domestic users need to set
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn # Domestic users need to set
exportPATH={Fluter code directory}/bin:$PATH
Copy the code

After adding and saving, run the following command to refresh the terminal:

source $HOME/.bash_profile
Copy the code

Run the following command to check that the flutter has been installed successfully:

flutter -v
Copy the code

The first run installs something, and then displays a welcome message indicating that it has been installed successfully.

You need to run the following command to check the dependencies of the flutter:

flutter doctor
Copy the code

When you run this command, the flutter will prompt you to install what is necessary and what command you need to execute to install it.

One of the necessary, please create a virtual Android virtual device, and keep the boot state.

The first Flutter App

Open VSCode and press F1(press FN on touchbar to see F1) to call out the command input box;

Enter the character “Flutter” and select “Flutter: New Project” from the command candidate list. Create a Flutter Project.

After the project is created, select the debug environment target in the lower right corner of VSCode:

Press F5 to run the project;

The solution is to delete the. Gradle folder in the user folder and install Gradle again using Brew. Gradle installation is available at https://gradle.org/

Without error, VSCode will download the necessary resources and then run the app on the target device (selected in the lower right corner).

Now the Flutter is installed and running! Now comes the journey of Flutter development