【问题标题】:Android, InstallException occurs when I use in-app updatesAndroid,当我使用应用内更新时发生 InstallException
【发布时间】:2019-09-27 01:01:21
【问题描述】:

在 Google I/O 2019 中,新增了应用内更新。

所以我尝试按照文档使用它:https://developer.android.com/guide/app-bundle/in-app-updates

但它发送了一个类似的 InstallException:

com.google.android.play.core.tasks.RuntimeExecutionException: com.google.android.play.core.install.InstallException: Install Error: -6
    at com.google.android.play.core.tasks.k.getResult(Unknown Source:18)
    at com.eastriver.workingtimer.ui.MainActivity$onCreate$1.onComplete(MainActivity.kt:35)

我的代码在这里:

val appUpdateManager = AppUpdateManagerFactory.create(this)
val appUpdateInfo = appUpdateManager.appUpdateInfo
appUpdateInfo.addOnCompleteListener {
    val result = it.result
    if (result.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE
                    && result.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)) {

        info("should show update")
        appUpdateManager.startUpdateFlowForResult(
            result,
            AppUpdateType.FLEXIBLE,
            this,
            1)
    } else {
        info("This is already latest version!")
    }
}

我知道,它就在今天发布。 但是有人知道吗?

【问题讨论】:

  • 有趣。我收到了这个错误:ERROR_API_NOT_AVAILABLE int ERROR_API_NOT_AVAILABLE The API is not available on this device. Constant Value: -3 (0xfffffffd)

标签: android google-play in-app-update google-play-core


【解决方案1】:

错误代码记录在the javadoc

这说:

int ERROR_INSTALL_NOT_ALLOWED

由于当前设备状态(例如低 电池,磁盘空间不足,...)。

常数值:-6 (0xfffffffa)

所以我怀疑您的设备没有空间或未插入电源,并且此设备上的更新首选项需要电源和 WiFi。

【讨论】:

  • 哇,我需要这个链接!谢谢你:)
【解决方案2】:

如果您正在使用模拟器,请确保您已安装并登录 Google Play 商店。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-08-05
  • 1970-01-01
  • 2023-03-07
  • 1970-01-01
  • 2012-09-20
  • 2013-12-01
相关资源
最近更新 更多