Flutter learning (2) Create a flutter project

This article uses Android Studio to create a Flutter project and run it successfully.
The running process may involve network environment configuration issues.
Friends who think it is too simple can just ignore it.

development environment

win10
androidstudio2022.1.1
jdk11
fluttersdk-flutter_windows_3.7.8

practice

Follow the following process: first click to create a project,
Insert image description here
select flutter sdk
Insert image description here
and fill in the project information
Insert image description here
. Click create, wait for android studio to run, and wait for loading to complete.

run

Click the green triangle icon in the upper right corner of Android Studio to run.
There are two situations here. If your network is good, you can start running after a while. If your network is not good, you need to perform some additional network environment configuration.

Network environment configuration

(1) Enter the packages\flutter_tools\gradle folder and open the flutter.gradle file. The directory is as shown below:
Insert image description here
Open the arrow file, find the buildscript location, and modify it as follows:

Modification point 1

Insert image description here

Modification point 2

Insert image description here

Modification point 3

androidstudio build.gradle deployment
Insert image description here

Related instructions:

maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }

private static final String DEFAULT_MAVEN_HOST = "https://storage.flutter-io.cn"

(2) Enter the flutter\packages\flutter_tools\gradle folder, and then open the resolve_dependencies.gradle file. The directory is as follows:
Insert image description here
Find the repositories and modify the dependencies as follows:
Insert image description here
Then save. Clear the cache and restart Android Studio, and try clicking the install button again to check the installation status.

that’s all-------------------------------------------------------------

Guess you like

Origin blog.csdn.net/motosheep/article/details/129775951