← Back to archive
Programming Notes

Flutter Configuration

Flutter looked quite interesting, so I downloaded it to try. After installing Android Studio and the Flutter plugin in Visual Studio Code, pressing F5 as instructed did not work; trying a real device also failed.

These steps are needed to get it running in one go:

1. Download Android Studio

2. Download Flutter

3. Add environment variables

4. Download and configure Gradle, preferably set it directly in Settings so the wrapper download is not too slow.

5. Modify the project's Gradle: comment out google() and jcenter() in build.gradle, and add:

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' }

Also pay attention to the version number in the classpath; if the default is 3.5.1, change it to match the Android Studio version you downloaded:

classpath 'com.android.tools.build:gradle:4.0.1'

6. In the SDK:

flutter/packages/flutter_tools/gradle/flutter.gradle

Change to:

private static final String MAVEN_REPO="http://download.flutter.io";
flutter/packages/flutter_tools/gradle/resolve_dependencies.gradle

Change to:

url "http://download.flutter.io"

Written by Master Sanfu on November 29, 2020. Please credit the source if you share.

Translation Notice: This English version was translated with AI assistance. Specialized, historical, religious, or culturally sensitive terms may contain nuances, inaccuracies, or debatable wording. In case of ambiguity or discrepancy, the original Chinese text shall prevail.