Android 如何在动态特性模块中包含AAR?

Android 如何在动态特性模块中包含AAR?,android,android-app-bundle,dynamic-feature-module,Android,Android App Bundle,Dynamic Feature Module,我想将一个大型AAR库(“crypteriumsdk”)放入一个动态功能模块中,该模块可以按需安装。但当我这样做时,它找不到它的资源(主题): 资源样式/密码主题(又名 找不到com.crypter.cryptocyrency:style/CrypteriumTheme) 我还将tools:replace=“android:theme”添加到主清单(应用程序模块)中的application 这里怎么了 settings.gradle: include ':crypteriumsdk' inc

我想将一个大型AAR库(“crypteriumsdk”)放入一个动态功能模块中,该模块可以按需安装。但当我这样做时,它找不到它的资源(主题):

资源样式/密码主题(又名 找不到com.crypter.cryptocyrency:style/CrypteriumTheme)

我还将
tools:replace=“android:theme”
添加到主清单(应用程序模块)中的
application

这里怎么了

settings.gradle

include ':crypteriumsdk'
include ':wallet'
include ':app'
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(":app")
    implementation project(':crypteriumsdk') // added the library here
}
wallet.gradle

include ':crypteriumsdk'
include ':wallet'
include ':app'
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation project(":app")
    implementation project(':crypteriumsdk') // added the library here
}

清单合并得太早,实际的主题实现无法在用户设备上使用

您可以将其添加到基本模块的styles.xml中:

    <style name="CrypteriumTheme" />

这允许在安装时找到样式资源id,并在模块可用并启动后将其覆盖


请参阅以了解有效的实现。

谢谢,这很有效!你知道我可以对来自第三方库的同名资源做些什么吗?例如,我们在基本(应用)模块中使用库A,然后在动态功能模块中使用库B,两个库都有一些同名的布局资源。这会在尝试构建捆绑包时出错:
模块“base”和“dynamicfeature”包含具有不同内容的条目“res/layout/design\u bottom\u navigation\u item.xml”。
。我知道这是一个离题的问题,但我非常感谢你在这方面的经验:)这里有一个关于这个问题的问题:谢谢你提出来。我在问题上加了一句话。