ML Kit 与动态功能模块崩溃(有条件交付)

发布于 2025-01-12 03:32:45 字数 1589 浏览 1 评论 0原文

我正在开发一项利用 ML Kit 翻译的功能,由于此功能仅适用于特定国家/地区,因此我已将此功能的实现以及 ML Kit 依赖项移至动态功能模块,并在显然根据用户所在国家/地区有条件。

我已按照此指南移动 ML Kit在基础应用程序 build.gradle 文件中添加支持依赖项:

dependencies {
implementation 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta2'
}

这样做后,如果满足条件并且在安装时包含功能模块,则应用程序在打开应用程序时开始崩溃,否则一切正常。

这是崩溃的日志:

   java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.android.gms.internal.mlkit_translate.zzxa]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.common.sdkinternal.SharedPrefManager, type=required, injection=direct}, Dependency{anInterface=class com.google.android.gms.internal.mlkit_translate.zzwx, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.SharedPrefManager

 Caused by: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.android.gms.internal.mlkit_translate.zzxa]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.common.sdkinternal.SharedPrefManager, type=required, injection=direct}, Dependency{anInterface=class com.google.android.gms.internal.mlkit_translate.zzwx, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.SharedPrefManager

知道如何解决这个问题吗?

I'm working on a feature that utilizes ML Kit Translation, and since this feature is only available for a specific country, I've moved the implementation for this feature along with ML Kit dependency to a dynamic feature module and set the delivery in the manifest to be conditional according to the user's country.

I've followed this guide to move the ML Kit by adding support dependency in the base app build.gradle file:

dependencies {
implementation 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta2'
}

After doing so, the application started to crash on app open if the condition is met and the feature module is included at install time, otherwise everything works fine.

Here's the log for the crash:

   java.lang.RuntimeException: Unable to get provider com.google.mlkit.common.internal.MlKitInitProvider: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.android.gms.internal.mlkit_translate.zzxa]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.common.sdkinternal.SharedPrefManager, type=required, injection=direct}, Dependency{anInterface=class com.google.android.gms.internal.mlkit_translate.zzwx, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.SharedPrefManager

 Caused by: com.google.firebase.components.MissingDependencyException: Unsatisfied dependency for component Component<[class com.google.android.gms.internal.mlkit_translate.zzxa]>{0, type=0, deps=[Dependency{anInterface=class com.google.mlkit.common.sdkinternal.SharedPrefManager, type=required, injection=direct}, Dependency{anInterface=class com.google.android.gms.internal.mlkit_translate.zzwx, type=required, injection=direct}]}: class com.google.mlkit.common.sdkinternal.SharedPrefManager

Any idea how can I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文