flutter: flutter pub get failed65、项目构建时卡死

学习flutter时遇到的问题

1.构建项目时,项目一直卡在创建页面:

在这里插入图片描述
我的情况是:flutter doctor显示的配置已经完成,FLUTTER_STORAGE_BASE_URLPUB_HOSTED_URL环境变量也配置了,但是就是卡在这个页面。后来强制杀死进程,多试了几遍竟然构建成功了,运行到手机也正常。后来在使用http的时候

http: '>=0.11.3+12'

点击pubget,出现了一个错误:

flutter pub get failed65

查了一些资料发现这两个问题都跟环境变量有关,最后发现我的变量值写错了。。。。
附上正确的地址:
FLUTTER_STORAGE_BASE_URL
https://storage.flutter-io.cn

PUB_HOSTED_URL
https://pub.flutter-io.cn

在这里插入图片描述

2.后来又莫名出现另一个问题,一并记在这了:

Could not find io.flutter:flutter_embedding_debug
Could not find io.flutter:arm64_v8a_debug
Could not find io.flutter:x86_debug
Could not find io.flutter:x86_64_debug

在这里插入图片描述
解决办法:找到android目录下的bulid.gradle,
在dependencies节点添加:

classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'

allprojects -> repositories节点下添加:

maven {
    
     url "https://storage.googleapis.com/download.flutter.io" }

附上截图

在这里插入图片描述

写的不好,仅作记录!

猜你喜欢

转载自blog.csdn.net/weixin_40652755/article/details/109468840