问题1:The log reader stopped unexpectedly
1.断开设备
2.清除设备的缓存数据(移动)的文件管理器应用程序
3.Run flutter clean
4.连接您的设备并运行应用程序
问题2:代码各种依赖报错
解决:
flutter clean
看看是否可以了:flutter run
还是出错:
flutter pub cache repair
最后:flutter clean
当 flutter pub cache repair 过程报错时,就退出终端 执行flutter clean 再次执行flutter pub cache repair
我试过(从androidstudio)Tools > Flutter > Flutter Clean
和File > Invalidate Caches / Restart...,但都没用。
问题3:下载慢
git clone -b stable https://github.com/flutter/flutter.git 比较缓慢解决方案如下
请配置环境变量,以Linux为例:
打开/etc/profile或~/.bashrc,添加环境变量
export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn
export PUB_HOSTED_URL=https://dart-pub.mirrors.sjtug.sjtu.edu.cn
问题4:Building flutter tool…慢
flutter doctor时Building flutter tool...缓慢添加如下环境变量
#export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn
#export PUB_HOSTED_URL=https://dart-pub.mirrors.sjtug.sjtu.edu.cn
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn