使用Firebase远程配置实施强制更新时出错

时间:2018-10-01 12:01:57

标签: firebase firebase-remote-config

我正在尝试使用Firebase远程配置在我的Android应用中实施强制更新。在MyApplicatio类中,我编写以下代码:

HashMap<String, Object> remoteConfigDefaults = new HashMap<>();
    remoteConfigDefaults.put(ForceUpdateChecker.KEY_UPDATE_REQUIRED,false);
    remoteConfigDefaults.put(ForceUpdateChecker.KEY_CURRENT_VERSION, "1.0.0");
    remoteConfigDefaults.put(ForceUpdateChecker.KEY_UPDATE_URL,
            "https://play.google.com/store/apps/details?id=com.sembozdemir.renstagram");

    firebaseRemoteConfig.setDefaults(remoteConfigDefaults);

    firebaseRemoteConfig.fetch(60) // fetch every minutes
            .addOnCompleteListener(new OnCompleteListener<Void>() {
                @Override
                public void onComplete(@NonNull Task<Void> task) {
                    if (task.isSuccessful()) {
                        Log.d(TAG, "remote config is fetched.");
                        firebaseRemoteConfig.activateFetched();
                    }
                }
            });

但是firebaseRemoteConfig.setDefaults()导致FatalException。

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: ir.academyofmusic.academyofmusic, PID: 31372
java.lang.NoClassDefFoundError: com.google.android.gms.internal.zzexm
    at com.google.android.gms.internal.zzexd.run(Unknown Source)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)

0 个答案:

没有答案