Flutter needs to be configured with both iOS and Android development environments and may encounter various problems. This article summarizes most of the possible situations that Flutter may encounter

IDE recommends that You use Android Studio to develop Flutter App. After all, you are Google’s son, with better Code hints and features. If you want to be more lightweight, you can try VS Code. This section focuses on the configuration of Android Studio + Fluuter SDK. It is recommended to use V P N for the whole process, which is relatively fast.

1. Download and install the JRE

  • JRE

Download and install Android Studio

  • Android Studio

  • If you don’t have to install Xcode and CocoPods, please make your own installation, CocoPods installation may refer to www.jianshu.com/p/f43b5964f…

  • ! Note: Try not to install the latest version of Ruby, use the penultimate version of Ruby, the latest version may not be compatible with Cocopods, test: Install Ruby 1.7.0, incompatible with the latest Cocopods, install 1.6.5

3. Download and configure the Flutter SDK

  • Download the latest SDK, Flutter_macOS_1.xx.xx-stables

Flutter SDK

  • Move the decompressed flutter folder to the SDK path you want to configure. I usually use the same folder as the repository

  • Configuring environment Variables

Open it with VS Code or Xcode.bash_profileIf no, create a new one

  • Add variable configuration and save exit
Export PATH=/ newly configured PATH /flutter/bin:$PATH export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cnCopy the code

  • Execute the command and display the help message if everything goes well
source ~/.bash_profile
flutter -h
Copy the code

4. Check whether the configuration is correct

  • By executing the command, he can help you test whether the Flutter environment has been successfully constructed. Note that the first three items must be [√]. As for the development tools listed in the 4-5 items, we use Android Studio
flutter doctor
Copy the code
  • It says there is a problem with item 2 and item 4. Let’s solve it in the following order:
1, need to accept android license agreement **! Some Android licenses not accepted** Go onto university ** The Fit fit plugin not installed**Copy the code

  • Execute command (process! Some Android licenses not accepted)
flutter doctor --android-licenses
Copy the code
  • Input y all the way,

  • Those who qualify can enter the Plugins plugin not installed.

  • Search for the install flutter plugin and click Restart to Restart. If you can’t find the plug-in, which I have encountered several times, you can try to open VPN, restart Android Studio, wait for the plug-in page data to load and then search, just try several times, I tried manually installing the plug-in failed, it is best to use Android Studio to install.

If this doesn’t work, you can try to install the plugin locally

  • Execute the command again
flutter doctor
Copy the code

  • To check Android licenses is taking an unexpectedly long time, you need to turn on the VPN and set up the proxy on your terminal

  • You can start a new Flutter project 🤣

5, Encounter Creating Flutter Project stuck

1. I have often encountered this problem recently. Is it Android Studio or something else that is not supported

2, if run directly, because domestic mirror, may be an error, Could not resolve com. Android. View the build: gradle: 3.5.0, use VPN also useless

3, solution: modify build.gradle, comment out jcenter(), Google (). Copy the following code using Ali’s image.

// The main functions of Maven here are: project building, project dependency management. 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

If an error is reported again, check whether the agent is enabled or log out and reopen the project

4. If you don’t want to modify build.gradle every time, you can directly configure the build.gradle corresponding to the SDK, so that the next time you create a project, you can use it directly

Your path of flutter SDK/packages/flutter_tools/gradle me here/Users/RSF/flutter/packages/flutter_tools/gradleCopy the code

Open with VSCode or Android Studio, release jcenter(), Google (). Use ali’s mirror image

5, if ali mirror address change, please refer to the maven.aliyun.com/mvn/guide

6, Waiting for another flutter command to release the startup lock

  1. Close the AndroidStudio
  2. Find the /bin/cache path of the Flutter SDK installation path, delete the lockfile file, and then open AndroidStudio. If not, try to delete the file and restart the PC

7, -bash: fultter: command not found

If your configuration is correct, simply run the following command, print out the correct information, and then run the other commands

source .bash_profile
flutter -h 
Copy the code

8, and other

  1. The Xcode environment should be configured by itself. Details enable VPN access to flutter. Dev /setup/
  2. Execute which flutter to obtain the flutter SDK path,
  3. Those who qualify Android SDK are missing Command Line tools. Download from XXX, you will need to reinstall or update your Android SDK.
  4. If the Dart SDK is not available when you open the IDE, configure the Flutter SDK path

!

9. Friendly links

  • Official plugin Search
  • Because Chinese website
  • Flutter-Tips

Big guy blog recommended:

  • Love cat de Xiao Guo
  • Vadaski
Have a question can leave a message, see the reply