Google 的侧载检查文档发生了什么变化?

What happened to Google's sideload check documentation?

使用 app bundle 时,存在用户将 "sideload" 自定义 APK 安装到不兼容设备上的风险。这可能会导致崩溃,因为所需的密度/语言将不存在。

要解决这个问题,Google Play Core 中有一个方便的 MissingSplitsManager。这会在启动时显示用户 a helpful error 而不是崩溃。所有需要做的就是将以下内容添加到应用程序 class:

override fun onCreate() {    
    if (MissingSplitsManagerFactory.create(this).disableAppIfMissingRequiredSplits()) {
        return
    }
    super.onCreate()
} 

此检查非常容易实施,详细说明以前可在 https://developer.android.com/guide/app-bundle/sideload-check. There are links to this all over, e.g. in a Realm issue, or at the top of the MissingSplitsManager documentation

但是,这个 link 现在重定向到一个 "Known issues" 部分,非常模糊:

Partial installs of sideloaded apps—that is, apps that are not installed using the Google Play Store and are missing one or more required split APKs—fail on all Google-certified devices and devices running Android 10 (API level 29) or higher. When downloading your app through the Google Play Store, Google ensures that all required components of the app are installed.

所以,发生了什么事?为什么图书馆的简单检查不再提了,即使在documentation for the library.

也许库中存在一些未记录的问题?也许 Google 根本不想帮助侧载?

这个库虽然方便,但在找到更好的解决方案之前只是一个临时解决方案。该库会在应用程序每次启动时有效地读取磁盘,这会影响启动延迟。请注意,这会影响所有用户,无论他们是否有所有拆分,但仅对侧载应用程序的用户有用,这样他们会收到警告消息而不是崩溃。

Android 平台现在拒绝安装不具备所有必需拆分的应用程序,从而使侧载 API 变得不必要。此解决方案适用于所有 Android 版本。