Use the following steps to build Play Asset Delivery into your project’s Android App Bundle. You don't need to use Android Studio to perform these steps.
Import the Play Core Library into your project.
Update the version of the Android Gradle plugin in your project’s
build.gradle
file to4.0.0
or later.In the top-level directory of your project, create a directory for the asset pack. This directory name is used as the asset pack name. Asset pack names must start with a letter and can only contain letters, numbers, and underscores.
In the asset pack directory, create a
build.gradle
file and add the following code. Make sure to specify the name of the asset pack and only one delivery type:// In the asset pack’s build.gradle file: apply plugin: 'com.android.asset-pack' assetPack { packName = "asset-pack-name" // Directory name for the asset pack dynamicDelivery { deliveryType = "[ install-time | fast-follow | on-demand ]" } }
In the project’s app
build.gradle
file, add the name of every asset pack in your project as shown below:// In the app build.gradle file: android { ... assetPacks = [":asset-pack-name", ":asset-pack2-name"] }
In the project’s
settings.gradle
file, include all asset packs in your project as shown below:// In the settings.gradle file: include ':app' include ':asset-pack-name' include ':asset-pack2-name'
In the asset pack directory, create the following subdirectory:
src/main/assets
.Place assets in the
src/main/assets
directory. You can create subdirectories in here as well. The directory structure for your app should now look like the following:build.gradle
settings.gradle
app/
asset-pack-name/build.gradle
asset-pack-name/src/main/assets/your-asset-directories
Build the Android App Bundle with Gradle. In the generated app bundle, the root-level directory now includes the following:
asset-pack-name/manifest/AndroidManifest.xml
: Configures the asset pack’s identifier and delivery modeasset-pack-name/assets/your-asset-directories
: Directory that contains all assets delivered as part of the asset pack
Gradle generates the manifest for each asset pack and outputs the
assets/
directory for you.(Optional) Configure your app bundle to support different texture compression formats.
Next step
Integrate Play Asset Delivery into your game or app code using one of the following: