I'm trying to build a soundboard app. I have lots of sounds to deploy so I decided to use Play Asset Delivery. I followed the instructions in the Google's guide.
I created an asset pack folder in the top level and named it sounds. This is how my project looks
Project structure:
This is the build.gradle
file in the sounds directory
apply plugin: 'com.android.asset-pack'
assetPack {
packName = "sounds" // Directory name for the asset pack
dynamicDelivery {
deliveryType = "[install-time]"
}
}
Updated my app build.gradle file
android {
.
.
.
assetPacks = [":sounds"]
}
and my settings.gradle file
include ':app'
include ':sounds'
When I try to build the bundle I keep getting this error
Gradle Error:
This is the Manifest in the sounds folder
Manifest with errors:
I tried cleaning the project, invalidating caches and restarting but nothing seems to work.
After spending so many hours I managed to build the bundle successfully.
Simply remove brackets from your asset folder's build.gradle file
deliveryType = "install-time"
This is Google's example code for Play Asset Delivery
// 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 ]"
}
}
I thought deliveryType = "[install-time]" would be the correct syntax. After comparing my asset pack manifest with a dynamic feature's manifest I realized gradle produces a wrong dist attribute.
This is what i got for writing deliveryType with brackets
<dist:[install-time]/>
This is the correct syntax in the dynamic feature's manifest
<dist:on-demand />
Removing brackets did the trick. Hope it helps someone.