2

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?

Hoda M
  • 65
  • 6

3 Answers3

2

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.

Hoda M
  • 65
  • 6
0

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)

Manzur Alahi
  • 1,870
  • 23
  • 19
0

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

ArpitA
  • 721
  • 7
  • 17
  • I'm getting the error while trying to build not during run time. The linked issue seems to be a run time error? – Hoda M Oct 16 '19 at 20:34