The first flutter program

VS needs to add flutter and Dart Code. Restart the compiler after installation

Vscode creates a Flutter project

command +shift + p Flutter: New Project

Run Project

Exception: Gradle Task assembleDebug failed

Exception: Gradle task assembleDebug failed with exit code 1

Solution:

Set the mirror address to replace the default Gradle foreign repository address

Modify the build.gradle file in the Android file package of the Flutter project

/ / set ali mirror 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

Modify the gradle file under Flutter

  • /flutter/packages/flutter_tools/gradle/flutter.gradle

Rerun terminal: flutter run:

hello world