I have a base
module and a feature module called query
module in my Instant App project.
My QueryActivity
inside query
module uses colors that are in base
module.
QueryActivity.kt:
@ColorInt
val textColor: Int = when (resultCode) {
FetchAddressIntentService.RESULT_SUCCESS -> android.R.color.white
FetchAddressIntentService.RESULT_FAILURE -> R.color.accent // this color is inside the base module
else -> R.color.accent // this color is inside the base module
}
If I try to run
the project, it works fine without any problem. But If I rebuild
the project, it gives me the following error:
../net/epictimes/uvindex/query/QueryActivity.kt
Error:(133, 63) Unresolved reference: color
Error:(134, 27) Unresolved reference: color
Pointing to those color values.
I solved this by I adding another colors.xml
file inside the query
module and referencing the base
colors from it. It worked fine. You can see the diff in this commit.
<color name="query_location_success_text">@android:color/white</color>
<color name="query_location_fail_text">@color/accent</color>
Right now it works but I am not sure why. Is this the right way to do it? My question is shouldn't be the resources inside base
module accessible from the feature modules?
Versions:
Android target/compile SDK: 26
Kotlin: 1.1.50
Instant Apps: 1.1.0
That is a open source project of mine, you can see whole project here.
Thank you