我想在我的應用中使用Firebase Remote Config。 我在Android Studio中創建新項目,並按文檔建議運行Tools - Firebase助手。 在上console.firebase.google.com
創建應用程序和旁邊設置添加到我的根build.gralde
:classpath 'com.google.gms:google-services:3.0.0'
和到App build.gralde
:使用助理添加助手後,Firebase顯示NoSuchMethodError
apply plugin: 'com.google.gms.google-services'
…
compile 'com.google.firebase:firebase-config:10.2.0'
比我添加到我的MainActivity:
mFirebaseRemoteConfig.activateFetched();
mFirebaseRemoteConfig.fetch();
當我運行程序的時候,用日誌崩潰在fetch()
命令:
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
java.lang.NoSuchMethodError: No static method zzz(Ljava/lang/Object;)Ljava/lang/Object;
in class Lcom/google/android/gms/common/internal/zzaa;
or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa'
appears in /data/app/my.packagename-1/base.apk)
at com.google.android.gms.measurement.internal.zzx.zzbd(Unknown Source)
我試過了ti禁用即時運行和分級清除,但仍然有這個問題。如何解決它?
UPD:我弄清楚,如果我搬到線apply plugin: 'com.google.gms.google-services'
從第二到最後一行中的應用build.gralde
這個解決的問題,但爲什麼呢?
是的,將「應用」行移動到最後一行解決了我的問題。 :-) – Marlon