Unity-Technologies / Addressables-Sample

Demo project using Addressables package
1.29k stars 298 forks source link

Play Asset Delivery sample does not properly load from fast-follow Asset Pack #79

Closed AmericanFarming closed 2 years ago

AmericanFarming commented 2 years ago

In the build (with Google AAB enabled and Split Binary Enabled) I get this error:

2022/07/21 02:46:24.286 18827 18893 Error Unity Unable to open archive file: jar:file:///data/app/~~gxXApkMk8ruxFu9eaUAgMQ==/com.squadbuilt.af-uz7s-6oSaqWPZBUrYokMNQ==/split_UnityDataAssetPack.apk!/assets/aa/map_assets_all_a7a80834016864ae22e9f95f6478a5c2.bundle

This is what entries in BuildProcessData.json look like

{"BundleBuildPath":"Library/com.unity.addressables/aa/Android/map_assets_all_a7a80834016864ae22e9f95f6478a5c2.bundle","AssetsSubfolderPath":"AFSFastFollow.androidpack\map_assets_all_a7a80834016864ae22e9f95f6478a5c2.bundle"}

This is what the entries in CustomAssetPacksData.json look like

{"Entries":[{"AssetPackName":"AFSFastFollow","DeliveryType":2,"AssetBundles":["map_assets_all_a7a80834016864ae22e9f95f6478a5c2"]}]}

This is what AppBundleTransformFunc returns as location.InternalId

jar:file:///data/app/~~gxXApkMk8ruxFu9eaUAgMQ==/com.squadbuilt.af-uz7s-6oSaqWPZBUrYokMNQ==/split_UnityDataAssetPack.apk!/assets/aa/map_assets_all_a7a80834016864ae22e9f95f6478a5c2.bundle

Stack Trace: 2022/07/21 02:46:24.281 18827 18869 Info Unity AppBundleTransformFunc (jar:file:///data/app/~~gxXApkMk8ruxFu9eaUAgMQ==/com.squadbuilt.af-uz7s-6oSaqWPZBUrYokMNQ==/split_UnityDataAssetPack.apk!/assets/aa/map_assets_all_a7a80834016864ae22e9f95f6478a5c2.bundle) 2022/07/21 02:46:24.281 18827 18869 Info Unity AddressablesPlayAssetDelivery.PlayAssetDeliveryInitializeOperation:AppBundleTransformFunc(IResourceLocation) 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.ResourceProviders.AssetBundleRequestOptions:ComputeSize(IResourceLocation, ResourceManager) 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource:get_BytesToDownload() 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource:GetDownloadStatus() 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation1:SetDownloadProgressCallback(Func1) 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.ResourceProviders.AssetBundleResource:Start(ProvideHandle) 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.ResourceProviders.AssetBundleProvider:Provide(ProvideHandle) 2022/07/21 02:46:24.281 18827 18869 Info Unity UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1:Execute()

Now, in the AAB file, the file path is

/AFSFastFollow/assets/map_assets_all_a7a80834016864ae22e9f95f6478a5c2.bundle

I even copied the asset packs directly from my phone after deployment, and AFSFastFollow-master.apk has the same file path. The bundle files exist there.

Why is it trying to load the incorrect file path, and how do I specify the correct one? Is it as simple as changing the Asset group's Load path? I tried doing that and it didn't work but maybe I need to specify something specific?

Current Project:

Any ideas on how to get this fast-follow pack to load properly? I think it should be referencing AFSFastFollow.apk, not split_UnityDataAssetPack.apk, as the former is the fast-follow data and the latter is the install-time data. The install-time data works fine.

Here is the AAB file structure image

AmericanFarming commented 2 years ago

After fixing a number of issues with the Addressable sample code and tweaking the group settings I have managed to get this to work.

Here are the final group settings image