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

调用Firebase Remote Config的fetch()方法时App崩溃求助

解决Firebase Remote Config fetch崩溃(NoSuchMethodError)问题

你的App调用Firebase Remote Config的fetch方法时崩溃,核心原因是Google Play Services/Firebase库版本不一致或版本过旧,导致类方法签名不匹配引发的错误。

问题分析

从崩溃日志里的关键报错:

java.lang.NoSuchMethodError: No static method zzz(Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzaa;

这种错误几乎都是因为项目里混入了不同版本的Google Play Services(GMS)库,或者你当前用的11.8.0版本Firebase库太老旧,和系统、其他依赖存在兼容性冲突。

解决方案

1. 统一并升级Firebase/GMS库版本

把所有Firebase相关依赖统一升级到同一个稳定的新版本(建议用Firebase官方推荐的最新稳定版),同时替换已废弃的compile为implementation:

def google_play_version = "20.0.0" // 可根据Firebase官网更新到最新稳定版
implementation "com.google.firebase:firebase-core:$google_play_version"
implementation "com.google.firebase:firebase-messaging:$google_play_version"
implementation "com.google.firebase:firebase-config:$google_play_version"
implementation "com.google.firebase:firebase-analytics:$google_play_version"

2. 匹配Google Services插件版本

在项目根目录的build.gradle中,确保google-services插件版本和Firebase库版本兼容:

buildscript {
    dependencies {
        classpath 'com.google.gms:google-services:4.3.10' // 对应Firebase 20.x版本,按需调整
    }
}

3. 排查并排除依赖冲突

执行命令查看项目依赖树,找出是否有第三方依赖引入了不同版本的GMS库:

./gradlew dependencies

如果发现冲突,在对应的依赖中排除GMS模块,示例:

implementation('第三方依赖的包名') {
    exclude group: 'com.google.android.gms'
}

4. 清理缓存并重建项目

最后执行清理和构建命令,确保旧缓存被清除:

./gradlew clean
./gradlew assembleDebug

按以上步骤操作后,版本冲突导致的NoSuchMethodError应该就能解决,Firebase Remote Config也能正常调用了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 10:04:46