Crash in PlayAssetDeliveryAssetBundleProvider

Hi, after implementing PAD for my game I’m seing a lot of crashes in Crashlytics from PlayAssetDeliveryAssetBundleProvider. The stack trace is this:

Seems like the error is in CheckDownloadStatus method, which is implemented like this:

void CheckDownloadStatus(AndroidAssetPackInfo info)
        {
            _progress = info.transferProgress;
            _downloadStatus.TotalBytes = (long)info.size;
            _downloadStatus.DownloadedBytes = (long)info.bytesDownloaded;
            _downloadStatus.IsDone = info.status == AndroidAssetPackStatus.Completed;

            string message = "";
            if (info.status == AndroidAssetPackStatus.Failed)
                message = $"Failed to retrieve the state of asset pack '{info.name}'.";
            else if (info.status == AndroidAssetPackStatus.Unknown)
                message = $"Asset pack '{info.name}' is unavailable for this application. This can occur if the app was not installed through Google Play.";
            else if (info.status == AndroidAssetPackStatus.Canceled)
                message = $"Cancelled asset pack download request '{info.name}'.";
            else if (info.status == AndroidAssetPackStatus.WaitingForWifi)
                AndroidAssetPacks.RequestToUseMobileDataAsync(OnRequestToUseMobileDataComplete);
            else if (info.status == AndroidAssetPackStatus.Completed)
            {
                string assetPackPath = AndroidAssetPacks.GetAssetPackPath(info.name);

                if (!string.IsNullOrEmpty(assetPackPath))
                {
                    // Asset pack was located on device. Proceed with loading the bundle.
                    PlayAssetDeliveryRuntimeData.Instance.AssetPackNameToDownloadPath.Add(info.name, assetPackPath);
                    base.Provide(m_ProviderInterface);
                }
                else
                    message = $"Downloaded asset pack '{info.name}' but cannot locate it on device.";
            }

            if (!string.IsNullOrEmpty(message))
            {
                Debug.LogError(message);
                m_ProviderInterface.Complete(this, false, new Exception("exception"));
            }
        }

The PAD has been implemented following the official sample (GitHub - Unity-Technologies/Addressables-Sample: Demo project using Addressables package). The project is using Unity 2021.3.32f1.

Can’t reproduce this error with any of my 2 Android devices.

Any help is appreciated.

I’m using Addressables 1.19.19

Please, anyone? I got many users complaining about this error.

It seems the code about m_ProviderInterface.Complete(this, false, ... in PlayAssetDeliveryAssetBundleProvider.cs is wrong. It should be m_ProviderInterface.Complete<AssetBundleResource>(null, false, ....

1 Like

Thanks for answering. The code is copied from the official sample project (https://github.com/Unity-Technologies/Addressables-Sample), seems a bit strange to pass the first parameter as null but I will deploy one build with your suggestion to try. Thanks.

Thanks, it seems solved!

1 Like