首页 > 解决方案 > 在 Android 中使用应用内更新时如何解决安装状态码 -100?

问题描述

我正在从这里使用应用内更新: https ://developer.android.com/guide/app-bundle/in-app-updates

我已经在我的应用程序中成功实现了它。我的应用程序已经在 Playstore 中: https ://play.google.com/store/apps/details?id=com.tekitsolution.remindly

为了测试这个实现,我在我的项目中减少了版本,并在 Splash Activity 中实现了。

所以,我得到了更新屏幕,我点击更新并开始下载。完成下载后,它再次来到同一页面下载并且installErrorCode得到-100,这意味着Play商店发生内部错误。(有没有办法理解安装错误代码的实际含义?

Flow from update screen:
I printed logs for `state.installStatus()`
PENDING = 1;
DOWNLOADING = 2;
DOWNLOADED = 11;
INSTALLING = 3;

然后代替这个(INSTALLED = 4),我用 state.installErrorCode -100 得到 FAILED = 5

代码:

private InstallStateUpdatedListener installStateUpdatedListener = new
                        InstallStateUpdatedListener() {
                            @Override
                            public void onStateUpdate(InstallState state) {
                                showLog("In-App: " + state.installStatus());
                                showLog("installErrorCode " + state.installErrorCode());
                                if (state.installStatus() == InstallStatus.DOWNLOADED) {
                                    popupSnackbarForCompleteUpdate();
                                } else if (state.installStatus() == InstallStatus.INSTALLED) {
                                    if (mAppUpdateManager != null) {
                                        showLog("In-App: unregisterListener");
                                        mAppUpdateManager.unregisterListener(installStateUpdatedListener);}

                                }
                            }
                        };

注意:我也尝试过使用不同的设备。

标签: androidin-app-update

解决方案


推荐阅读