Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build and configure Flutter+Idea environment under Windows

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to build and configure Flutter+Idea environment under Windows". In daily operation, I believe many people have doubts about how to build and configure Flutter+Idea environment under Windows. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to build and configure Flutter+Idea environment under Windows". Next, please follow the editor to study!

Install Flutter SDK

First of all, download the flutter_windows_v2.5.1 package in the official document (as shown in the red box below), extract it to your specified location, and extract the folder name as flutter, which is Flutter SDK (needed later when you configure it in ide). At the same time, add the path where bin is located in flutter in the system path.

Note that do not install flutter to a path that requires some high permissions, such as C:\ Program Files\)

Install flutter

Find the flutter_console.bat file in the flutter directory you just downloaded, and double-click the runnable file. (there are several ways to install flutter on the Internet, such as opening and running, entering powerShell, and then running flutter doctor. I have tried to have problems, or the most reliable method on the official website), and then enter the instruction: flutter doctor, you can automatically install, this is the method recommended by the official website, very reliable. However, because of our national policy, using the above method will always be in the following interface:

Finally, the timeout is displayed directly:

Therefore, we use the address of the domestic image to download: enter the following two sentences before entering flutter docter:

1) enter the first item on the command line: set PUB_HOSTED_URL= https://pub.flutter-io.cn

2) enter the second item on the command line: set FLUTTER_STORAGE_BASE_URL= https://storage.flutter-io.cn

3) enter the flutter doctor command again to execute successfully

The above perfect solution: Got socket error trying to find package mockito at https://pub.dartlang.org. This question.

This installation is successful.

If the following problem occurs, please follow the steps below to fix it, mainly because we are using Idea without using Android Studio and not installing Android sdk. You need to install the configuration manually.

Download SDK Manager Tools

Download here, drop down on the official website, and download the sdkManager of the corresponding platform in Command line tools only.

Download and decompress to get the folder cmdline-tools. Our Android sdk is placed under D:\ Android\ sdk. The extracted directory should be placed in F:\ Android\ sdk\ cmdline-tools\ latest, otherwise an error will be reported when sdkmanager is executed.

Execute the sdkmanager-- list command

No error was reported, and the order was executed successfully.

Cause Analysis and solution Source: https://stackoverflow.com/questions/65262340/cmdline-tools-could-not-determine-sdk-root

Download the required platforms and tools

Execute sdkmanager "platform-tools"platforms;android-29"

Download the required platform and tools. The android system I prepared is 10, and the corresponding platform is 29.

Enter y to agree to the license and wait for the download to complete

Check that the sdk directory has changed

Execute the command sdkmanager "build-tools;28.0.3" to download build-tools

First execute flutter config-- android-sdk F:\ Android\ sdk, specify the android sdk path, and then flutter doctor-- android-licenses to repair the license.

Fill in y all the way until the execution is complete.

Execute the flutter doctor command again

Configure environment variables

Create a new environment variable ANDRIOD_HOME with a value of SDK installation directory, such as F:\ Android\ sdk

Configure the environment variable Path, adding% ANDROID_HOME%\ tools,%ANDROID_HOME%\ platform-tools and% ANDROID_HOME%\ build-tools

At this point, the configuration of flutter and android sdk has been completed.

Install the Dart and Flutter plug-ins

(1) Flutter needs the support of the following two plug-ins:

The Flutter plug-in is used to support the process of Flutter developers (running, debugging, hot loading, etc.)

The Dart plug-in provides code analysis (code validity checking, code completion, etc.)

(2) then download the Dart plug-in in Android studio or IntelliJ IDEA. If you can't, that's why you don't have scientific access to the Internet. You can also download it through the link below. If you downloaded it yourself through the link below, extract the downloaded zip package and copy the entire folder to the plugins folder of the ide you are using (the whole folder can be copied to plugins).

Https://plugins.jetbrains.com/pluginManager/?action=download&id=Dart&build=IU-172.3757.52&uuid=076050b4-d279-493c-945e-5fb3ff2af32e

(3) then download the flutter-intellij plug-in in Android studio or IntelliJ IDEA. If you can't, that's why you don't have scientific access to the Internet. You can also download it through the link below. If you downloaded it yourself through the link below, extract the downloaded zip package and copy the entire folder to the plugins folder of the ide you are using (the whole folder can be copied to plugins).

Https://plugins.jetbrains.com/pluginManager/?action=download&id=io.flutter&build=IU-172.3757.52&uuid=076050b4-d279-493c-945e-5fb3ff2af32e

Configure the Dart and Flutter plug-ins into our idea

Open idea,Create New Project-- > Select Flutter, Next-- > name the project name (lowercase) after selecting the SDK path, and ok after selecting the project storage path.

Then after entering, you may see that the project resources have not been downloaded. Don't panic, let's configure it. The details are as follows. The first is the path to configure DartSDK (point to bin\ cache\ dart.sdk in the SDK of the previous flutter), and the second is to configure the flutter SDK path. Restart ide after the configuration is completed, and then recreate the new project. It will take a long time to wait. Just wait patiently for completion.

The first time we run it, we need to create a simulator, download the corresponding image according to andriod sdk, find the configuration of android skd in settings, and click edti.

Click next in the pop-up window to start downloading

You need to wait for a certain amount of time to complete the download. Click the finish button when the download is complete.

Download the required system image

Then you can run the project and configure it to run to Chrome (web)

Running result

At this point, the configuration is complete

At this point, the study on "how to build and configure the Flutter+Idea environment under Windows" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report