应用具有 ML Kit 功能(翻译)。我正在尝试通过引入动态模块功能来减小应用的大小,实现按需加载。
遵循此指南,在基础apk的 build.gradle 中添加了 'com.google.mlkit:playstore-dynamic-feature-support:16.0.0-beta1'
在特性模块 build.gradle 中添加了'com.google.mlkit:translate:16.1.2',一切都编译并尝试在模拟器上运行,但不幸的是,在应用启动时崩溃并记录日志:
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
这有点说不通。因为我已经添加了playstore-dynamic-feature-support。