1、环境变量
.zshrc
bash
#Flutter
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
export FLUTTER_HOME=/Users/leon/Flutter/flutter_3_10_4/flutter
export PATH=$FLUTTER_HOME/bin
2、Android项目
(1)android/build.gradle
android/build.gradle
groovy
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' }
(2)Gradle
android/gradle/wrapper/gradle-wrapper.properties
(3)AGP
android/build.gradle
(4)设置 Flutter 和 Dart
- Flutter Sdk
- Dart Sdk
3、配置 Flutter Sdk
(1)flutter\packages\flutter_tools\gradle\flutter.gradle
groovy
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' }
(2)flutter\packages\flutter_tools\gradle\resolve_dependencies.gradle
groovy
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' }
maven { url 'https://storage.flutter-io.cn/download.flutter.io' }