Unity Releases Android App Bundle Detailed Explanation (4) Addressables+Play Asset Delivery Distribution

In the previous article we learned:

  • Unity aab requires us to handle it ourselves, and Unity currently does not provide a complete solution to help us handle it automatically (as of 2021.7.16)
  • Starting from August 1, 2021, Google can only accept the aab format for new applications, and the aab ontology package is limited to 150M
  • Apps in aab format exceeding 150M must be distributed through Play Asset Delivery
  • Unity applications need to split the package body through AssetBundle, and then distribute it through Play Asset Delivery provided by GooglePlay

We have finished all the previous work, and now we start to package aab and upload the background work of Google. 

Import GooglePlay plugin

There is a complete official document here , you can go here to see the detailed steps, I will briefly explain the steps.

We first download the corresponding Play Asset Delivery plug-in from GitHub and import it into Unity. The plug-in encapsulates some interfaces, such as obtaining our resource pack, downloading the resource pack, reading the resource pack to memory, etc. With this plug-in we can Only then can the next work be carried out.

Import Addressables+Play Asset Delivery support library

Because Unity does not currently have good support for the integration of Addressables and aab, Addressables needs to be handled by itself.

pay attention: 

Use this library for distribution, the commands in the Google/Android App Bundle must not be used again, otherwise the configuration file will be overwritten

Configure Addressables

Next, you need to configure Addressables to integrate the addressable system with these two plugins.

There are also many pitfalls, and the documentation is not clear. After the integration is completed, the effect is always unsatisfactory. I located the problem through source code analysis.

Configure Addressables Groups

The divided Addressables Groups should look like this (if this step does not work, please check the steps in the previous article)

You can create a new Group or the default

Configure distribution mode

The meaning of this step is to let Play Asset Delivery recognize how your group is loaded, whether to use install-time or on-demand还是fast-follow. There are several groups that need to be configured several times.

  • Select Group, in the Inspector interface we see the figure, these configurations are optional, the default is fine (because it is not used)
  • Click the Add Schema button and select Play Asset Delivery
  • Configure Delivery Mode (please read the previous article if you don’t understand what these mean).
    Only Install Time has been tested, and the other two have not been used yet, so let’s not talk about it
  • Select Group again, click Advance Options, and modify the two circled places
  • Change the circled two places to the following
    Note: These two are a bit similar, remember not to match them wrong, and be careful
    Asset Provider: Assets From Bundles Provider (Sync)
    AssetBundle Provider: AssetPack Bundle Provider (Sync)

After the configuration is complete, you can start packaging later

pack aab

Packaging Addressables

After the above configuration is completed, first package the resource package

Run Build-New Build-Default Build Scripts and wait for the progress bar to end

Create an Asset Pack configuration recognized by GooglePlay

When aab is packaged, it recognizes the PlayAssetPackConfig.json file under the Library, so now we need to modify the addressables configuration to the PlayAssetPackConfig.json file so that Google can recognize it.

Create configuration:

  • Run the command: Create config for Addressables Groups and wait for the end
  • After the end, there will be an AssetPacks file in the Asset/Resources directory, which records the Addressables configuration.
    The principle is: this file records the file key, and then when the Addressables is initialized, the resources are read through the Play Asset Delivery interface.

Package aab file 

Run the command Google/Build Android App Bundle... command, select the directory, and wait for the progress bar to end

Note: Remember to set up the Keystore first

The correct progress bar should be as shown in the figure

 

after packing

 

Change the suffix name to rar, open it with the compressed package to confirm, if there is a circled file, it means OK

The complete file is an aab file, just upload it to the Google background

Upload Google background

upload aab file

confirmation document

After the upload is complete, you can see the distribution content in the App Bundle explorer. The base is the size of the ontology package. The distribution content will be listed under Asset Packs. You can see that the distribution mode there will write the mode configured on the Addressables side

release test

 Download through the Google Play Store, and the downloaded package size is the sum of the body package size + the package size of the install time.

Tips

If the test is found to be incorrect, you can add two macro definitions ADDRESSABLES_LOG_ALL; DEBUG_PLAYASSETDELIVERY when packaging

In this way, the LogCat software will output the log loaded by Addressables, which can speed up the analysis.

At the same time, you can also view the source code to debug and locate the problem.

Summarize

This series of articles is officially over, and there are still quite a lot of pitfalls. Google is humanized to players, but it is a pain to developers. Unity is a bit of a stretch this time. UE4 has integrated PlayAssetDelivery, but Unity still has no complete solution. Program (as of 2021.7.16).

Thank you for reading, and I hope these articles are helpful to you and make this technology ecology better.

sample project

If you read this series of articles and still don’t know how to do it, or follow the article and keep failing, I newly uploaded a successful demo of Unity, which can be downloaded for reference: Unity Play Asset Delivery sample project icon-default.png?t=L892https://download.csdn.net /download/egostudio/23355975

The sample project has been configured, and it can be packaged directly using the steps in the article. After uploading to the background and downloading it, you can see that the pictures in the scene are loaded and displayed.

The sample project can also be obtained for free by adding Q group 904994482. If you have any questions, please add Q group to ask questions, thank you.

Previous: Unity Releases Android App Bundle Detailed Explanation (3) Quickly Convert Addressables

Series Article Index

Unity Releases Android App Bundle Detailed Explanation (1) Unity .aab Support

Unity Releases Android App Bundle Detailed Explanation (2) Introduction to Play Asset Delivery

Unity Releases Android App Bundle Detailed Explanation (3) Quickly Convert Addressables

Unity Releases Android App Bundle Detailed Explanation (4) Addressables+Play Asset Delivery Distribution

Guess you like

Origin blog.csdn.net/egostudio/article/details/118787073