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

标签 android android-instant-apps

当我尝试缩小我的功能 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/46219987/

相关文章:

android - 以纵向模式拍摄视频,但使用媒体播放器播放时方向错误

java - FragmentActivity 与 Fragment 类型 GoogleMap 交互

android - Android 中的多个微调器

android - Egit 无法排除/bin?

安卓 : How to repeat a Toast every second

android - Branch.io 和即时应用程序

Android 免安装应用 APK

android - Instant App 无法下载完整的应用程序 | Google Play 认为应用已安装

android - 从网站切换到免安装应用

android - 找不到参数的方法 kapt()