Running "flutter pub get" in flutter_app...卡死

本文介绍了解决在使用flutter框架进行项目开发时,遇到的“flutter pub get”命令卡死的问题。通过修改.bash_profile文件中的镜像源,并在编辑器中删除lockfile文件,可以有效解决此问题。

Packages get偶尔会遇到Running “flutter pub get” in flutter_app…卡死的问题。
解决办法
1.打开终端,输入:open .bash_profile
2.打开 .bash_profile ,修改下镜像
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

重启下编辑器,如果还是卡死的话,关掉编辑器,打开flutter安装目录,进入/bin/cache,找到lockfile文件,删除就可以了。
打开编辑器重新Packages get

PS D:\vietnam_asd_app\vietnam_asd_app> flutter run Flutter assets will be downloaded from https://storage.googleapis.com/flutter_infra_release. Make sure you trust this source! Launching lib\main.dart on sdk gphone64 x86 64 in debug mode... You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply Flutter assets will be downloaded from https://storage.googleapis.com/flutter_infra_release. Make sure you trust this source! FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:checkDebugAarMetadata'. > Could not resolve all files for configuration ':app:debugRuntimeClasspath'. > Could not find io.flutter:x86_64_debug:1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4. Searched in the following locations: - https://dl.google.com/dl/android/maven2/io/flutter/x86_64_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/x86_64_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom - https://repo.maven.apache.org/maven2/io/flutter/x86_64_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/x86_64_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom - https://storage.googleapis.com/flutter_infra_release/download.flutter.io/io/flutter/x86_64_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/x86_64_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom Required by: project :app > Could not find io.flutter:x86_debug:1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4. Searched in the following locations: - https://dl.google.com/dl/android/maven2/io/flutter/x86_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/x86_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom - https://repo.maven.apache.org/maven2/io/flutter/x86_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/x86_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom - https://storage.googleapis.com/flutter_infra_release/download.flutter.io/io/flutter/x86_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/x86_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom Required by: project :app > Could not find io.flutter:flutter_embedding_debug:1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4. Searched in the following locations: - https://dl.google.com/dl/android/maven2/io/flutter/flutter_embedding_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/flutter_embedding_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom - https://repo.maven.apache.org/maven2/io/flutter/flutter_embedding_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/flutter_embedding_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom - https://storage.googleapis.com/flutter_infra_release/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4/flutter_embedding_debug-1.0.0-edd8546116457bdf1c5bdfb13ecb9463d2bb5ed4.pom Required by: project :app > project :device_info_plus project :app > project :package_info_plus project :app > project :permission_handler_android project :app > project :shared_preferences_android project :app > project :speech_xf project :app > project :url_launcher_android project :app > project :webview_flutter_android * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 33s Running Gradle task 'assembleDebug'... 34.8s Error: Gradle task assembleDebug failed with exit code 1
最新发布
12-11
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值