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

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

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:

    1. apply plugin: 'com.android.asset-pack'
    2. assetPack {
    3. packName = "sounds" // Directory name for the asset pack
    4. dynamicDelivery {
    5. deliveryType = "[install-time]"
    6. }
    7. }
  2. Updated my app build.gradle file:

    1. android {
    2. ...
    3. assetPacks = [":sounds"]
    4. }

    and my settings.gradle file:

    1. include ':app'
    2. 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

  1. apply plugin: &#39;com.android.asset-pack&#39;
  2. assetPack {
  3. packName = &quot;sounds&quot; // Directory name for the asset pack
  4. dynamicDelivery {
  5. deliveryType = &quot;[install-time]&quot;
  6. }
  7. }

<br>

  1. Updated my app build.gradle file

    1. android {
    2. .
    3. .
    4. .
    5. assetPacks = [&quot;:sounds&quot;]
    6. }

and my settings.gradle file

  1. include &#39;:app&#39;
  2. 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

  1. deliveryType = &quot;install-time&quot;

<br>
<br>

This is Google's example code for Play Asset Delivery

  1. // In the asset pack’s build.gradle file:
  2. apply plugin: &#39;com.android.asset-pack&#39;
  3. assetPack {
  4. packName = &quot;asset-pack-name&quot; // Directory name for the asset pack
  5. dynamicDelivery {
  6. deliveryType = &quot;[ install-time | fast-follow | on-demand ]&quot;
  7. }
  8. }

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

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

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

  1. &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:

确定