【发布时间】:2020-03-04 10:46:11
【问题描述】:
使用 app bundle 时,用户可能会将自定义的 APK “旁加载”到不兼容的设备上。这可能会导致崩溃,因为所需的密度/语言将不存在。
为了解决这个问题,Google Play Core 中有一个方便的MissingSplitsManager。这显示用户 a helpful error 在启动时而不是崩溃。所需要做的就是将以下内容添加到应用程序类中:
override fun onCreate() {
if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
return
}
super.onCreate()
}
这项检查很容易实施,之前在https://developer.android.com/guide/app-bundle/sideload-check 上提供了详细说明。到处都有链接,例如in a Realm issue,或在the MissingSplitsManager documentation 的顶部。
但是,此链接现在重定向到“已知问题”部分,非常模糊:
侧载应用的部分安装(即未使用 Google Play 商店安装且缺少一个或多个必需的拆分 APK 的应用)在所有 Google 认证设备和运行 Android 10(API 级别 29)的设备上失败,或者更高。通过 Google Play 商店下载您的应用时,Google 会确保安装了该应用的所有必需组件。
那么,发生了什么?为什么图书馆的简单检查不再提及,即使在documentation for the library。
也许图书馆存在一些未记录的问题?也许 Google 根本不想帮助侧载?
【问题讨论】:
标签: android android-app-bundle sideloading