Search code examples
javaandroidandroid-app-bundle

Play Asset Delivery Android resource linking failed - Execution failed for task :app:linkDebugManifestForAssetPacks


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.

  1. 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]"
}
}

  1. Updated my app build.gradle file

    android {
    .
    .
    .
    assetPacks = [":sounds"]
    }
    

and my settings.gradle file

include ':app'
include ':sounds'

  1. Placed the assets in the sounds/src/main/assets

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.


Solution

  • 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.