gpt4 book ai didi

android - shrinkResources true 不能用于 Instant Apps 功能?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:21:15 25 4
gpt4 key购买 nike

当我尝试缩小我的功能 APK 大小时,我在我的功能构建 Gradle 中使用 shr​​inkResources true。但是它提示 Error:Resource shrinker cannot be used for libraries.

这篇文章要求我们使用它 https://medium.com/jet-stories/make-your-app-instant-33855ab5d02b

是我做错了什么还是 Instant Apps 真的不支持?

最佳答案

据我从这篇文章中了解到(我只是快速阅读了它,仍在我的阅读列表中),shr​​inkResources true 只需要将 APK 大小减小 removing unused resources ,但这不是 Instant Apps 的正式要求。我猜工具链无法决定库中是否未使用资源,因为最终 APK 尚未构建。

因此,如果您的项目中没有未使用的资源,应该没有问题,可以将其删除。

然后,您的项目中可能存在一件事(我自己没有尝试过 Instant Apps,只是阅读并看到了 Google IO 演讲):据我了解,instant app 的所有模块都是 APK,而不是图书馆。因此,如果您将 shr​​inkResources true 应用到 APK,您就可以开始了。如果您的项目中有用于组装最终 APK 模块的库,请删除那里的 shr​​inkResources true,并将其保留在模块中。

关于android - shrinkResources true 不能用于 Instant Apps 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49874388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com