问题
I'm trying out the in-app update feature and I'm getting a FAILED install status and a -100 install error code. Is there any way for me to know what may be causing this?
I implemented the flexible in-app update and I'm logging each step. Followed Android devs tutorial here
I'm generating an apk with a lower version code as the one in Google Play and signing using the same signing key.
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 1
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 1
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 1
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:01 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 2
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 11
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | completeUpdate was called.
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 3
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install error : 0
2019-07-24 16:21:12 +0100 InAppUpdates [String#-594849490] [T# main] | onPause
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install error : -100
2019-07-24 16:21:12 +0100 InAppUpdates [String#-666477938] [T# main] | install status : 5
回答1:
You can find values for InstallStatus
((i.e) install status : %d) here and the values for InstallErrorCode
((i.e) install error : %d) here.
InstallStatus
CANCELED Constant Value: 6 (0x00000006) DOWNLOADED Constant Value: 11 (0x0000000b) DOWNLOADING Constant Value: 2 (0x00000002) FAILED Constant Value: 5 (0x00000005) INSTALLED Constant Value: 4 (0x00000004) INSTALLING Constant Value: 3 (0x00000003) PENDING Constant Value: 1 (0x00000001) REQUIRES_UI_INTENT To perform the installation, a Play Store UI flow needs to be started. Constant Value: 10 (0x0000000a) UNKNOWN Constant Value: 0 (0x00000000)
InstallErrorCode
ERROR_API_NOT_AVAILABLE The API is not available on this device. Constant Value: -3 (0xfffffffd) ERROR_DOWNLOAD_NOT_PRESENT The install/update has not been (fully) downloaded yet. Constant Value: -7 (0xfffffff9) ERROR_INSTALL_IN_PROGRESS The install is already in progress and there is no UI flow to resume. Constant Value: -8 (0xfffffff8) ERROR_INSTALL_NOT_ALLOWED The download/install is not allowed, due to the current device state (e.g. low battery, low disk space, ...). Constant Value: -6 (0xfffffffa) ERROR_INSTALL_UNAVAILABLE The install is unavailable to this user or device. Constant Value: -5 (0xfffffffb) ERROR_INTERNAL_ERROR An internal error happened in the Play Store. Constant Value: -100 (0xffffff9c) ERROR_INVALID_REQUEST The request that was sent by the app is malformed. Constant Value: -4 (0xfffffffc) ERROR_UNKNOWN An unknown error occurred. Constant Value: -2 (0xfffffffe) NO_ERROR No error occurred; all types of update flow are allowed. Constant Value: 0 (0x00000000) NO_ERROR_PARTIALLY_ALLOWED No error occurred; only some types of update flow are allowed, while others are forbidden. Constant Value: 1 (0x00000001)
回答2:
Clear the PlayStore app Storage from the Android Settings App - Settings -> Apps -> Play Store -> Storage -> clear data
and this error will disappear .. I don't what is the actual reason for this error .. and there no documentation that can guide you.
回答3:
I've been dealing with this issue for a day or so now and the issue was that my apk wasn't signed and verified. I believe that when you run an unverified apk AppUpdateManager will check for an available update on the PlayStore, however during the installation process it will fail when it realizes that its replacing an unverified apk with a verified one.
来源:https://stackoverflow.com/questions/57186822/is-there-a-way-to-understand-what-install-error-codes-actually-mean