集成保活,需要注意点 - xiaoniudonghe2015/Android-Java-Code-Style GitHub Wiki
Caused by: java.lang.IllegalStateException:
at com.google.firebase.FirebaseApp.getInstance (FirebaseApp.java)
at com.google.firebase.FirebaseApp.getInstance (FirebaseApp.java)
at com.google.firebase.remoteconfig.FirebaseRemoteConfig.getInstance (FirebaseRemoteConfig.java)
at com.common.firebase.config.CommonRemoteConfig.<init> (CommonRemoteConfig.java)
at com.common.firebase.config.CommonRemoteConfig.getInstance (CommonRemoteConfig.java)
at com.common.firebase.config.CommonRemoteConfig.access$000 (CommonRemoteConfig.java)
at com.messenger.util.Utils.isCallFlashSwitchEnabled (Utils.java)
at com.messenger.util.Utils.isCallFlashEnabled (Utils.java)
at com.callresult.CallResultService.start (CallResultService.java)
at com.callresult.CallResultService.showCallResultUI (CallResultService.java)
at com.callresult.CallResultService.registerPhoneStateReceiver (CallResultService.java)查看源码,发现完整的log应该是
throw new IllegalStateException("Default FirebaseApp is not initialized in this process " + ProcessUtils.getMyProcessName() + ". Make sure to call FirebaseApp.initializeApp(Context) first.");在该进程中没有调用初始化firebase导致的
双进程Service里面有调用Remote Config的话,在之前调用
FirebaseApp.initializeApp(this);确保调用之前已经初始化.
java.lang.RuntimeException: Using WebView from more than one process at once with the same data directory is not supportedApplication中添加以下代码:
public void setWebViewPath(Context context) {
//java.lang.RuntimeException: Using WebView from more than one process at once with the same data directory is not supported
//android 9.0开始不支持同时使用多个进程中具有相同数据目录的WebView, 针对这个问题,谷歌也给出了解决方案:在初始化的时候,需要为其它进程webView设置目录
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
String processName = Utils.getCurrentProcessName(context);
if (!getPackageName().equals(processName)) {//判断不等于默认进程名称
WebView.setDataDirectorySuffix(processName);
}
}
}