c0dehunter
c0dehunter

Reputation: 6150

How to include AAR in Dynamic Feature Module?

I want to put a big AAR library ("crypteriumsdk") into a Dynamic Feature Module, which can be installed on-demand. But when I do that, it can't find its resources (theme):

resource style/CrypteriumTheme (aka com.crypter.cryptocyrrency:style/CrypteriumTheme) not found.

I also added tools:replace="android:theme" to application in main Manifest (app module).

What is wrong here?

enter image description here

enter image description here

settings.gradle:

include ':crypteriumsdk'
include ':wallet'
include ':app'

wallet.gradle:

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

Upvotes: 0

Views: 1544

Answers (1)

Ben Weiss
Ben Weiss

Reputation: 17922

The Manifest gets merged too early for the actual theme implementation to be available on the user's device.

You can add this to your base module's styles.xml:

    <style name="CrypteriumTheme" />

This allows for the style resource id to be found at install time and for it to be overwritten once the module is available and launched.

See this sample for a working implementation.

Upvotes: 3

Related Questions