Problem description
The following error was returned when I requested OSS resources by using OSS SDK for Android:
com.alibaba.sdk.android.oss.ClientException: No value for StatusCode
org.json.JSONException: No value for StatusCode
[ErrorMessage]: No value for StatusCode
org.json.JSONException: No value for StatusCodeCauses
The error message is returned because an error occurs when OSS SDK for Android parses JSON data that does not include a specific required parameter.
Solutions
You can perform the following steps to troubleshoot the error:
Check the URL of the STS server in the code for using OSSAuthCredentialsProvider to access the STS server to obtain temporary access credentials. The temporary access credentials are used to initialize an OSSClient instance. For more information, see Initialization.
NoteIn the preceding sample code, STS_INFO_URL indicates the URL of the server from which temporary access credentials are obtained for initializing an OSSClient instance.
Check the OSSAuthCredentialsProvider class of the SDK to obtain the temporary access credentials requested from the STS server and request handling. In the following sample code, your OSS resource request is allowed only when the JSON data includes a value of 200 for the StatusCode header. Otherwise, the "No value for StatusCode error" is returned.

According to the preceding sample, if you use OSSAuthCredentialsProvider to initialize an OSSClient instance, the JSON data returned from STS must be in the following format:
NoteThe StatusCode field is case-sensitive and required.
{ "StatusCode":200, "AccessKeyId":"STS.NTH8eXffvqKXXXXXXCHMsu", "AccessKeySecret":"5rfu1899GJFJKXXXXXXXXXXXoGaTHX6V5BR4PZkNZ5x", "Expiration":"2021-08-10T06:57:05Z", "SecurityToken":"CAIS0w9XXXXXXXXXB2yfSjIr5f9c9/si7lXxomlNVWA00XXXXXXXXXlzz2IH1EfndpAOkfs/g/nmBU5/gSlqJ4T55XXXXXXzUco0/uc2T1fau5JkXXXXXXX9Umwyta2/SuH9S8ynQpXJQlvYlyh17KLnfDG5JTKMOoGIjpgVPrZyWRKjPwJbGPBcJAZptK1/MmDKZ9KsKQLSi3DMFygYvRFn20p17r6j59CY9hvGhUfm9/cRoI39WLbGCfNhJ5BiSdy48fVrf67aqk5q5gNN6b19gd4Gm3fOtcrPBEJKsVfUcbiY2OBEDyJFUY4TPoMD4N/Wt9BThtvrranZ6iYPH5kMDH6GGNz4mpWVSLrxZo9kT9uhZSSRiOLoH4LurgYpbUgcMA53YNc7Ihdyc0dxGmuEc/b+oQ2WMl3zF/nbgLtV3ZN+z1zu8saHPESf1CVTZ47E1fQagAE1EJun71o0MsRXEO6ZV5yra1zCnTlzwihYnH2NpGVngyDEI1niaqpA50Rch+r+6Ff3CWNzhn/tlzhI5tZjDaS4C6g8zvbc/zDWpxF6gq6QpwaLbDj7vEgbun6AuYy5PuXEZO6+j5Zzvxt333R73gPQN2oqRqaewdStQF3NrCKgYw==" }To fix the problem, use one of the following methods. For more information, see Set up direct data transfer for mobile apps.
Modify the code for generating temporary access credentials to include the StatusCode parameter in the JSON data returned by STS to OSS SDK for Android.
Modify the code of OSS SDK for Android to include the value of the Key parameter instead of the value of the StatusCode parameter in the JSON data returned by STS.