Search code examples
androidandroid-studioarchitecturemulti-module

Multimodular Android App: Unable to access Strings from another module


I am trying to modularize my application and I have a shared module where I put my shared resources and strings. In my module I have a dependency to the shared module as following:

implementation(project(Modules.shared))

Let's say I am working in Onboarding Module. When I want to call R.string.mystring, mystring is not found. But when I write packageNameOfSharedModule.R.string.mystring, it works.

In another projects, I can access any resource from the current modul's package.

What I am missing ? Thanks in advance!


Solution

  • That would be "non-transitive R files"

    https://blog.blundellapps.co.uk/speed-up-your-build-non-transitive-r-files/

    Check if you have this in your gradle.properties file:

    android.nonTransitiveRClass=true