android - 动态特征。错误 : failed processing manifest

标签 android module kotlin

我有一个基本模块,我想创建一个包含一些库的功能。其中一个库位于基本模块中,当我将其移至功能并从基本模块中删除时,出现错误:

APT: error: resource style/SDKTheme.Translucent (aka io.app.dev.debug:style/SDKTheme.Translucent) not found.



如果基本模块和功能模块具有这种依赖关系,它就可以工作,但在这种情况下,我失去了分离的好处。

我发现了一个已知问题:

In a dynamic feature module’s manifest, you should not reference resources that don’t exist in the base module. That’s because, when Google Play generates your app’s base APK, it merges manifests for all modules into that of the base APK. So, resource linking breaks if the base APK’s manifest references resources that don’t exist in the base APK.



这是我的问题吗?

最佳答案

是的,这正是你的问题。

解决方案是:

  • 在功能模块中实际实现您的样式,但在基本模块中创建一个空的样式声明。空声明的外观示例如下:
  • <style name="SDKTheme.Translucent" />
    发生的情况是 list 合并在合并过程中采用了这种样式,即使样式的实际实现是通过特性模块的样式引入的。
  • 将样式声明保留在基本模块中。虽然,这仅在引用的所有资源都在基本模块中时才有效。

  • 欲了解更多信息,请阅读 Ben Weiss 的这篇博文 - https://medium.com/androiddevelopers/a-patchwork-plaid-monolith-to-modularized-app-60235d9f212e

    关于android - 动态特征。错误 : failed processing manifest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52111547/

    相关文章:

    javascript - 使用一次后删除 Javascript 模块中的公共(public)方法?

    linux - 构建一个没有源代码的linux模块

    kotlin - 如何使用特定策略拼合列表列表

    module - ocaml 模块和程序位于同一文件中

    android - 我在 kotlin 中使用 xml <include/> 标签时崩溃

    kotlin - 在 Kotlin 中使用条件选择排序属性

    android - 使用 Crashlytics 在 Unity Android 项目中启用 Multidex

    android - 仅在多模块项目中出现的 Jetpack Compose 性能问题

    android - 调用网络服务时应用程序崩溃

    java - Android - 将对象保存到 SharedPreferences 并在应用程序中的任何位置获取它