Verify non-Google Play app installs using Play core library

时间秒杀一切 提交于 2019-12-05 21:58:17

问题


Some context: Most of us may have faced this ResourceNotFoundException when we migrated to Android app bundle release method. It is evident that the issue is because of Side-loading the app. Reference here.

Google recently announced solution to this problem. Using play core library we can identify whether the app is side-loaded or not (Identifies the missing split apks). If the app is side-loaded it shows "Installation failed" popup and redirects to play store, where user can properly install the app via the Google Play store.

Problem: Everything works fine until the installation of missing split apks from play store. Now when I relaunch the app, it immediately crashes with an error saying.

Default FirebaseApp is not initialised in this process

Note: Directly downloading the app from play store works perfectly fine without any crash. The crash happens only when the app re-downloads because of side loading issue.

Code:
Project's build.gradle:

buildscript {
 dependencies {
  classpath 'com.android.tools.build:bundletool:0.9.0'
 }
}

App module's build.gradle:

 implementation 'com.google.android.play:core:1.6.1'

Class that extends Application:

 public void onCreate() {
    if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
        // Skip app initialization.
        return;
    }
    super.onCreate();
    .....
 }

Any help would be really great.

来源:https://stackoverflow.com/questions/56725415/verify-non-google-play-app-installs-using-play-core-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!