问题描述
在 Google I/O 2019 中,新增了应用内更新.
In Google I/O 2019, In-app update is added newly.
所以我尝试按照文档使用它:https://developer.android.com/guide/app-bundle/in-app-updates
So I am trying to use it following the document: https://developer.android.com/guide/app-bundle/in-app-updates
但它发送了一个类似的 InstallException:
But it sent an InstallException like:
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!")
}
}
我知道,它就在今天发布.但是有人知道吗?
I know, it is released just nowadays.But somebody knows this?
推荐答案
错误代码记录在 javadoc.
这说:
int ERROR_INSTALL_NOT_ALLOWED
由于当前设备状态(例如低电池,磁盘空间不足,...).
The download/install is not allowed, due to the current device state (e.g. lowbattery, low disk space, ...).
常数值:-6 (0xfffffffa)
Constant Value: -6 (0xfffffffa)
所以我怀疑您的设备没有空间或没有插入电源,并且此设备上的更新首选项需要电源和 WiFi.
So I suspect your device either does not have space or is not plugged in to power, and the update preferences on this device require power and WiFi.
这篇关于Android,当我使用应用内更新时发生 InstallException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!