I need to add different assets for each build variants in Android Studio and i'm trying to use Play Asset Delivery, unfortunately there its no documentation or at least i could not find it . Its this even possible ?
My plan its to replace the "old" delivery system of assets using obb , and its an app not a game .
Incredibly it seems like there's no way to set the assetPacks per flavor in build.gradle!
We have a lot of assetPacks, and a bunch of flavors, so we added a map that maps flavor name to assetPacks, and set assetPacks from that.
From our build.gradle:
// figure out what our current flavor is to use to set the asset packs
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
Pattern pattern = Pattern.compile("([A-Z][a-z]+)(Release|Debug)")
Matcher matcher = pattern.matcher( tskReqStr )
String currentflavor = ""
if( matcher.find() )
currentflavor = matcher.group(1).toLowerCase()
if ( AssetPacks[currentflavor] ) {
assetPacks = AssetPacks[currentflavor]
// sanity check
println AssetPacks[currentflavor]
}
else if ( currentflavor ) {
// sanity check
println "NO ASSET PACKS"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With