如果应用程序是通过捆绑包发布的,那么 Expo 中的 OTA 更新是否有效?

Do OTA updates in Expo work if the app has been published through a bundle?

我经常使用 expo publish 允许 OTA ("over the air") 更新,而无需在商店中进行正常发布(更多信息请参见我之前的问题 ).

现在我要从 APK 转移到 Android App Bundle,这样我就可以使用:

expo build:android -t app-bundle

而不是之前的 expo build:android -t apk,如 Expo 文档中所述 Building Standalone Apps

但是,在他们网站的文章 Publishing 中,我还阅读了:

Some native configuration can't be updated by publishing

  • Increment the Expo SDK Version
    (...)
  • Change your bundled assets under assetBundlePatterns

所以现在我想知道:如果我在商店中发布一个“.aab”文件(Android App Bundle),它是否也可以通过 expo publish 用于 OTA 更新?

简答:是。

这是一个有效的问题,因为两者都有 "bundle" 这个词,但捆绑资产独立于 Android App Bundle。

来自世博会的Configuration with app.json

"assetBundlePatterns"

An array of file glob strings which point to assets that will be bundled within your standalone app binary. Read more in the Offline Support guide

来自世博会的Offline Support

Bundle your assets inside your standalone binary

Expo can bundle assets into your standalone binary during the build process so that they will be available immediately, even if the user has never run your app before. This is important if:

  • Your users may not have internet the first time they open your app, or
  • If your app relies on a nontrivial amount of assets for the very first screen to function properly.

To bundle assets in your binary, use the assetBundlePatterns key in app.json to provide a list of paths in your project directory:

"assetBundlePatterns": [
  "assets/images/*"
],

Images with paths matching the given patterns will be bundled into your native binaries next time you run expo build.

捆绑资产只是您希望立即包含在应用程序中的图像和其他资产,用于 iOS 和 Android 构建。