Flutter运行环境配置小结

Posted guangdeshishe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flutter运行环境配置小结相关的知识,希望对你有一定的参考价值。

1.环境变量

FLUTTER_STORAGE_BASE_URL=https://mirrors.tuna.tsinghua.edu.cn/flutter
PUB_HOSTED_URL=https://mirrors.tuna.tsinghua.edu.cn/dart-pub

2.androidStudio运行Android项目一直卡在Running Gradle task 'assembleDebug'...

  • 项目/android/build.gradle添加阿里镜像
    repositories 
    	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' 
    
    
    allprojects 
        repositories 
            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' 
        
    
    
  • flutter\\packages\\flutter_tools\\gradle\\flutter.gradle
    buildscript 
        repositories 
            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' 
        
    
    

启动web项目白屏问题

原因:pc端的浏览器默认使用canvaskit渲染,改成html方式就可以了

  • 1.直接在终端运行命令:flutter run -d chrome --web-renderer html
  • 2.AndroidStudio > 运行按钮左侧main.dart下拉选择Edit Configurations > Additional run args:后面添加--web-renderer html命令就可以了

以上是关于Flutter运行环境配置小结的主要内容,如果未能解决你的问题,请参考以下文章

Flutter开发环境配置-Windows

运行flutter doctor命令检测环境是否配置成功报错及解决方案

flutter web开发环境配置

flutter web开发环境配置

macOS 配置flutter 环境

macOS 配置flutter 环境