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

huangapple go评论70阅读模式
英文:

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:
    Play Asset Delivery Android resource linking failed – Execution failed for task :app:linkDebugManifestForAssetPacks

    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]"
        }
    }
    
  2. Updated my app build.gradle file:

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

    and my settings.gradle file:

    include ':app'
    include ':sounds'
    
  3. Placed the assets in the sounds/src/main/assets.

When I try to build the bundle, I keep getting this error:

Gradle Error:
Play Asset Delivery Android resource linking failed – Execution failed for task :app:linkDebugManifestForAssetPacks

This is the Manifest in the sounds folder:

Manifest with errors:
Play Asset Delivery Android resource linking failed – Execution failed for task :app:linkDebugManifestForAssetPacks

I tried cleaning the project, invalidating caches, and restarting, but nothing seems to work.

英文:

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:
    Play Asset Delivery Android resource linking failed – Execution failed for task :app:linkDebugManifestForAssetPacks

<br>

This is the build.gradle file in the sounds directory

apply plugin: &#39;com.android.asset-pack&#39;

assetPack {
packName = &quot;sounds&quot; // Directory name for the asset pack
dynamicDelivery {
    deliveryType = &quot;[install-time]&quot;
}
}

<br>

  1. Updated my app build.gradle file

    android {
    .
    .
    .
    assetPacks = [&quot;:sounds&quot;]
    }
    

and my settings.gradle file

include &#39;:app&#39;
include &#39;:sounds&#39;

<br>

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

When I try to build the bundle I keep getting this error

Gradle Error:
Play Asset Delivery Android resource linking failed – Execution failed for task :app:linkDebugManifestForAssetPacks

This is the Manifest in the sounds folder

Manifest with errors:
Play Asset Delivery Android resource linking failed – Execution failed for task :app:linkDebugManifestForAssetPacks

I tried cleaning the project, invalidating caches and restarting but nothing seems to work.

答案1

得分: 6

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.

英文:

After spending so many hours I managed to build the bundle successfully.

Simply remove brackets from your asset folder's build.gradle file

deliveryType = &quot;install-time&quot;

<br>
<br>

This is Google's example code for Play Asset Delivery

// In the asset pack’s build.gradle file:
apply plugin: &#39;com.android.asset-pack&#39;

assetPack {
    packName = &quot;asset-pack-name&quot; // Directory name for the asset pack
    dynamicDelivery {
        deliveryType = &quot;[ install-time | fast-follow | on-demand ]&quot;
    }
}

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

&lt;dist:[install-time]/&gt;

This is the correct syntax in the dynamic feature's manifest

&lt;dist:on-demand /&gt;

Removing brackets did the trick. Hope it helps someone.

huangapple
  • 本文由 发表于 2020年8月14日 02:37:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/63401305.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定