You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android模拟器Flutter Run报错:Firestore提示网络异常但实际联网正常

Android模拟器Flutter Firestore网络报错(实际有网)的解决方法

报错信息:

W/Firestore(12362): This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.**

W/Firestore(12643): (24.2.2) [WatchStream]: (942dfc6) Stream closed with status: Status{code=UNAVAILABLE, description=Channel shutdownNow invoked, cause=null}.
W/DynamiteModule(12643): Local module descriptor class for com.google.android.gms.providerinstaller.dynamite not found.
I/DynamiteModule(12643): Considering local module com.google.android.gms.providerinstaller.dynamite:0 and remote module com.google.android.gms.providerinstaller.dynamite:0
W/ProviderInstaller(12643): Failed to load providerinstaller module: No acceptable module com.google.android.gms.providerinstaller.dynamite found. Local version is 0 and remote version is 0.

解决步骤:

  • 使用带Google Play服务的模拟器镜像
    打开Android Studio的AVD Manager,检查当前模拟器是否带有Google Play标识(创建模拟器时需选择带Google Play的系统镜像,而非仅Google APIs的版本)。如果没有,重新创建符合要求的模拟器。

  • 更新Google Play服务
    启动模拟器后,打开Google Play商店,检查并更新Google Play服务至最新版。若无法打开商店,尝试冷启动模拟器(AVD Manager中点击"Cold Boot Now"),或前往设置→应用→Google Play服务→存储,清除缓存和数据后重试。

  • 配置项目依赖
    在项目的android/app/build.gradle文件中,添加Google Play服务相关依赖:

    dependencies {
        // 保留原有依赖,新增以下内容
        implementation 'com.google.android.gms:play-services-base:18.2.0'
        implementation 'com.google.android.gms:play-services-firestore:24.2.2'
    }
    

    同步Gradle后,执行flutter clean && flutter run重新启动项目。

  • 检查模拟器网络配置
    确认模拟器网络设置为"Automatic",若使用代理需手动配置正确参数。可通过模拟器内浏览器访问网页,验证网络实际连通性。

  • 降级Firestore依赖版本(备选)
    若上述方法无效,在pubspec.yaml中降低cloud_firestore的版本(例如从最新版改为3.4.0),执行flutter pub get后重新运行项目。

内容的提问来源于stack exchange,提问作者berkaysahin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 04:45:33