androidandroid-resourcesdimensiondynamic-feature-moduledynamic-delivery

Incorrect value of app module dimen/color when using in dynamic-delivery module


I have app module and one dynamic module named - "chat". I have a layout and fragment resides in chat module, in layout there is a android:textSize="@dimen/sp20" written. Dimen is defined in app module due to that it is showing incorrect text size when I run it. I debugged it, it is equal to 12sp (36 for xxhdpi device).

I tried to use dimen programtically but same result. (landing_page_toolbar_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, resources.getDimension(com.sendbird.R.dimen.sp20))) . Carefully used "R" from app module package.

When I define the same value in chat module, it works perfectly. But it is not feasible for our scenario. I have tons of string, dimens, color resources with multiple configurations written in app module. Please share feasible solution.

Attaching screenshot for better understanding.Reflection based result comparison


Solution

  • Can you try by updating your app module resources with the "app_sp20" prefix, it will be resolved mostly.

    Common names are mostly overridden by SDKs/modules

    Still, you face the problem then use reflection as the last option.