在Android中,应用内更新安装始终失败,错误代码为-100

在Android中,应用内更新安装始终失败,错误代码为-100,android,google-play,auto-update,in-app-update,google-play-core,Android,Google Play,Auto Update,In App Update,Google Play Core,我已经在我的Android应用程序中实现了灵活的更新流程。我正在检查并请求MainActivity的onCreate()中的更新 更新应用程序时,始终安装失败,错误代码-100,如中所述。有人能帮我解决这个问题吗 val appUpdateManager = AppUpdateManagerFactory.create(this) appUpdateManager.registerListener { state -> if (state.installStatus() == In

我已经在我的Android应用程序中实现了灵活的更新流程。我正在检查并请求MainActivity的onCreate()中的更新

更新应用程序时,始终安装失败,错误代码
-100
,如中所述。有人能帮我解决这个问题吗

val appUpdateManager = AppUpdateManagerFactory.create(this)
appUpdateManager.registerListener { state ->
    if (state.installStatus() == InstallStatus.FAILED) {
        Log.e("::MG::", "appUpdateManager:Status.FAILED")
        Log.e("::MG::", "appUpdateManager:ErrorCode:"+state.installErrorCode())
    }

    if (state.installStatus() == InstallStatus.DOWNLOADED) {
        //sBR(mainhell, resources.getString(R.string.exit))
        val snackbar = Snackbar.make(
            mainhell,
            "Update has been downloaded. \nDo you want to install?",
            Snackbar.LENGTH_INDEFINITE
        )
            .setAction("INSTALL") {
                //If Downloaded Install Update
                val i = Intent(applicationContext, MainActivity::class.java)
                finish()
                startActivity(i)
                appUpdateManager.completeUpdate()
            }
        snackbar.setActionTextColor(Color.YELLOW)
        snackbar.show()

    }
}

val appUpdateInfoTask = appUpdateManager.appUpdateInfo
appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
    when {
        appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
                appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.FLEXIBLE)
        -> {
        appUpdateManager.startUpdateFlowForResult(
                    appUpdateInfo,
                    AppUpdateType.FLEXIBLE,
                    this,
                    FLEXIBLE_UPDATE
                )
        }
        appUpdateInfo.installStatus() == InstallStatus.DOWNLOADED -> {
            if (appUpdateManager != null) {
                appUpdateManager.completeUpdate()
            }
        }
    }
}
罗格特


有点晚了,但得到了这个问题并设法解决了它:当您尝试从调试版本升级到发布版本apk时,会出现errcode-100。这是不允许的

如果您在开发时处于调试模式,并试图更新到在Play Store上使用release标志发布的APK,则可能会发生这种情况


解决方案是简单地使用相同的目标releaserelease APK update,或调试调试目标(如果您的应用商店APK是release APK,这可能不可能)。

有点晚,但得到了这个问题并设法解决了:当您尝试从调试APK升级到release APK时,会出现错误代码-100。这是不允许的

如果您在开发时处于调试模式,并试图更新到在Play Store上使用release标志发布的APK,则可能会发生这种情况


解决方案只是使用相同的目标releaserelease APK update或调试目标(如果您的应用商店APK是release APK,这可能不可能)。

如果您获得解决方案,我将面临相同的问题,请帮助!我面临着同样的问题,如果你得到了解决方案,请帮助!
E/::MG::: appUpdateManager:InstallStatus.FAILED 
E/::MG::: appUpdateManager:installErrorCode:-100