Reputation: 65
I have my base module(Base), a dynamic feature module(A) and a common module(Common) that is not a a dynamic feature, its a library. When I add Common as a dependency of A, I'm able to use classes from it but my build fails because it can't find the resources (error: cannot find symbol R.drawable.myimage) from the Common library.
dependencies {
implementation project(":Common")
implementation project(':Base')
}
Is this a dynamic feature constraint or is something causing this?
Upvotes: 2
Views: 2077
Reputation: 741
Install SplitCompat in dynamic feature activity
override fun onAttach(context: Context?) {
super.onAttach(context)
SplitCompat.install(context)
}
You can refer official dynamic delivery documentation
https://github.com/arpitagarwal1301/AndroidHub/issues/8
Upvotes: 0
Reputation: 65
Turns out R.id.resource
will only get the resources from the feature module, com.yourdomain.base.R.id.resource
will reference resources of the base module which has access to the resources of the library module.
This solved my issue.
Upvotes: 2
Reputation: 2096
Import your library module (Common) by using
File --> New --> Import Module
you can always try a
Invalidate Caches & Restart
(awkwardly solves most issues with Android Studio)
Upvotes: 0