In-App Update gives InstallException (ERROR_API_NOT_AVAILABLE)

前端 未结 7 863
野性不改
野性不改 2021-02-01 23:04

Implemented in-app update feature, using the following code snippet:

private void showInAppUpdateDialog(boolean isMandat         


        
相关标签:
7条回答
  • 2021-02-01 23:32

    On top of what Vipal suggested, the issue may be due to a signature mismatch between the version you have installed on the device and the one that Play Store would deliver (this is a common issue if you try to test it with debug builds). See https://developer.android.com/guide/playcore/in-app-updates#troubleshoot

    Recently the Play Core API started returning an API_NOT_AVAILABLE error if the app is not owned by the user or the signatures mismatch, while before it used to return a successful UPDATE_NOT_AVAILABLE Task.

    The recommendation is:

    • if you use the Kotlin Extension, make sure that you are catching the exception thrown by requestAppUpdateInfo
    • if you use PlayCore Java, make sure you have an onFailureListener that handles failures from getAppUpdateInfo
    • in order to test a debug build, you can use Internal App Sharing, as explained here: https://developer.android.com/guide/playcore/in-app-updates#internal-app-sharing

    Source: I work on the Play Core team

    0 讨论(0)
  • 2021-02-01 23:40

    Well, in my case we've cleared Google Play app cache and we didn't launch the Google Play before our app. You have to do it to download fresh data from the store, which is necessary for the SDK.

    0 讨论(0)
  • 2021-02-01 23:41

    My app was working fine before today, but I started getting this error today. One temporary workaround is to clear your Google Play Store cache and storage and then try launching the app. For me, it works only the first time, but fails afterwards. Before launching the app again, I have to clear the cache and storage again. I think there is something wrong on Google Play Store side due to which this issue is happening because everything was fine for me before today.

    0 讨论(0)
  • 2021-02-01 23:42

    After long time of debugging. I found, this is because of we are testing the app directly in mobile. Even though we generate and use signed apk, this error will occur. The only way to get rid of this error is, we need to download the app from google play.

    We can use Internal app sharing to test or simply publish our app.

    0 讨论(0)
  • 2021-02-01 23:49

    Temporary workaround for the moment is to surround the OnCompleteListener with a :

    try {...} catch(e: RuntimeExecutionException) {...}

    Just to avoid having to clear the PlayStore cache everytime I relaunch the app

    0 讨论(0)
  • 2021-02-01 23:52

    Firstly, please check that you are using the latest version of the play library.

    Secondly, understated fact: Please check the app you are testing has the same package name which is available on the play store.

    Example:

    You have an app on the play store with package name com.example.app but you are testing your app with package name com.example.app.debug. You will get this error: ERROR_API_NOT_AVAILABLE

    Note: You need to have at least one version of your app on the play store when you are testing.

    0 讨论(0)
提交回复
热议问题