Android, InstallException occurs when I use in-app updates(Android,当我使用应用内更新时发生 InstallException)
问题描述
在 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
int ERROR_INSTALL_NOT_ALLOWED
由于当前设备状态(例如低电池,磁盘空间不足,...).
The download/install is not allowed, due to the current device state (e.g. low battery, 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Android,当我使用应用内更新时发生 InstallException
				
        
 
            
        基础教程推荐
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
 - Android Volley - 如何动画图像加载? 2022-01-01
 - Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
 - 如何将图像从一项活动发送到另一项活动? 2022-01-01
 - SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
 - iOS - UINavigationController 添加多个正确的项目? 2022-01-01
 - 如何比较两个 NSDate:哪个是最近的? 2022-01-01
 - Play 商店的设备兼容性问题 2022-01-01
 - 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
 - UIImage 在开始时不适合 UIScrollView 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
				
				
				
				