https://kotlinlang.org logo
#android
Title
# android
t

tapchicoma

10/05/2017, 8:48 AM
Hi, why
const
is not allowed for field that references generated const classes like android
R
subclasses? IMHO, technically it should be allowed. For example,
const val TEXT_RES = R.string.some_text
g

genovich

10/05/2017, 8:52 AM
It is allowed. Maybe you do something wrong? Show your code
t

tapchicoma

10/05/2017, 8:57 AM
hmm, just this on the top level
private const val DEFAULT_TITLE_TEXT_RES = R.string.big_teaser_title_text
and it says that R.string.XXX is not a constant value kotlin version is
1.1.51
, project itself is an android lib project
g

genovich

10/05/2017, 9:04 AM
Can’t reproduce. Try to “Invalidate cache / Restart”
g

gildor

10/05/2017, 9:04 AM
Maybe because R.string.big_teaser_title_text defined in an other module
g

genovich

10/05/2017, 9:05 AM
works on 1.1.4 & 1.1.51
g

gildor

10/05/2017, 9:08 AM
resource ids from other modules are not constants
t

tapchicoma

10/05/2017, 9:09 AM
no, R.string is defined in the same module will try to invalidate cache
doesn't help (
ok, the behavior is valid. It is an android lib project and R classes will be regenerated on main app build
👍 2