Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 544
Othmane_lam Avatar asked Sep 17 '25 20:09

Othmane_lam


1 Answers

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
like image 139
Blundell Avatar answered Sep 20 '25 11:09

Blundell