【问题标题】:InApp update functionality is not working am getting this error com.google.android.play.core.install.InstallException: Install Error: -3InApp 更新功能不起作用我收到此错误 com.google.android.play.core.install.InstallException: Install Error: -3
【发布时间】:2020-04-06 14:07:15
【问题描述】:

我正在尝试通过我的应用程序显示更新,但出现以下错误

com.google.android.play.core.install.InstallException:安装错误:-3

这是检查和更新App的代码

public void checkAppUpdate(){
                    // Creates instance of the manager.

    // Returns an intent object that you use to check for an update.
                    Task<AppUpdateInfo> appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

    // Checks whether the platform allows the specified type of update,
    // and checks the update priority.
                    appUpdateInfoTask.addOnSuccessListener(new OnSuccessListener<AppUpdateInfo>() {
                        @Override
                        public void onSuccess(AppUpdateInfo appUpdateInfo) {
                            Log.i("UpdateError123",appUpdateInfo.updateAvailability()+"");

                            if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE) {
                                // Request an immediate update.

                                try {
                        appUpdateManager.startUpdateFlowForResult(
                                // Pass the intent that is returned by 'getAppUpdateInfo()'.
                                appUpdateInfo,
                                // Or 'AppUpdateType.FLEXIBLE' for flexible updates.
                                AppUpdateType.IMMEDIATE,
                                // The current activity making the update request.
                                MainActivity.this,
                                // Include a request code to later monitor this update request.
                                1021);
                    } catch (IntentSender.SendIntentException e) {
                        e.printStackTrace();
                    }
                            }
                        }
                    });

                    appUpdateInfoTask.addOnFailureListener(new OnFailureListener() {
                        @Override
                        public void onFailure(Exception e) {
                       e.printStackTrace();
                       Log.i("UpdateError",e.toString()+"");
                        }
                    });
                }

【问题讨论】:

  • 我已经成功地在我的应用中实现了应用内更新并发表了一篇文章。只需从那里复制粘贴,一切都会奏效。这是链接:medium.com/@sa159871/…

标签: android in-app-update app-update


【解决方案1】:

不知何故,您没有从错误处理程序中获得带有 e.printStackTrace(); 的完整错误描述,或者您没有使用 android DDMS tool 来调试错误:

com.google.android.play.core.install.InstallException: Install Error(-3): The API is not available on this device. (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_API_NOT_AVAILABLE)

这意味着 Play 商店 和/或 Google Play 服务 未安装/启用。在模拟器上,确保使用“Google Play”ABI,其中包括商店和所需的服务。

【讨论】:

    猜你喜欢
    • 2022-06-30
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多