Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at GooglePlayStoreApi.GooglePlayStoreClient.DownloadApk(String packageName) in GooglePlayStoreApi-master\GooglePlayStoreApi\GooglePlayStoreClient.cs:line 192
at Test.Program.DownloadApk(GooglePlayStoreClient client, String packageName) in GooglePlayStoreApi-master\Test\Program.cs:line 46
at Test.Program.Main(String[] args) in GooglePlayStoreApi-master\Test\Program.cs:line 119
hi, I get this error:
With your code is tested: https://github.com/kagasu/GooglePlayStoreApi/tree/master/Test
code in line 192:
var apkDownloadUrl = appDelivery.AppDeliveryData.DownloadUrl;
My code to specify the error: (in "GooglePlayStoreClient.cs") https://anotepad.com/notes/ks2b66
public byte[] DownloadApk(string packageName) { HeaderSet("X-DFE-Device-Id", AndroidId); HeaderSet("Accept-Language", Country.GetCountryCode()); HeaderSet("Authorization", $"GoogleLogin auth={Auth}"); var appDetail = AppDetail(packageName).Result; var offerType = appDetail.DocV2.Offer[0].OfferType; var versionCode = appDetail.DocV2.Details.AppDetails.VersionCode; var appDelivery = AppDelivery(packageName, offerType, versionCode).Result; Console.WriteLine("appDelivery: "+ appDelivery.ToString()); Console.WriteLine("offerType: " + offerType.ToString()); Console.WriteLine("versionCode: " + versionCode.ToString()); var apkDownloadUrl = appDelivery.AppDeliveryData.DownloadUrl; return client.GetByteArrayAsync(apkDownloadUrl).Result; }
Console output:
Maybe not the correct "appDelivery" variable output And that's why it makes a mistake