All Products
Search
Document Center

The problem that the onFailure callback cannot be entered after the OSS Android SDK resumable upload fails.

Last Updated: Jul 16, 2021

Problem description

When you use the Android SDK of OSS for resumable upload, you can normally enter the onSuccess callback after the upload succeeds. However, if the upload fails, you cannot enter the onFailure callback.

Solution

  1. For more information, see the sample code of Android SDK resumable upload upload. Test locally to check whether the SDK has problems.
    • If you can call back normally, you can confirm that there is no problem with the SDK itself.

    • If the callback cannot be performed properly, you need to check the SDK configuration.
  2. After the SDK is introduced to the project, you cannot enter the onFailure callback. Make sure that Androidstudio has no network profilter set. The source code is written in kotlin. Currently, the Android SDK of OSS does not have a kotlin version. The source code is as follows:

    The preceding onFailure writing method has the problem of determining the null type. After you change the code as follows:
    onFailure(request: ResumableUploadRequest, clientExcepion:ClientException?, serviceException: ServiceException?)

  3. After the modification, confirm that the onFailure callback can be entered correctly.

Application scope

  • OSS