miguelsesma
06/27/2024, 2:07 PMbuildConfigField
I’ve added support for buildConfigField to the build.gradle.kt file and declare a BuildConfig sample value like:
buildConfigField("boolean", "BUILD_VALUE", "false")
Then in a sample activity I show the value
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
TestKotlin2Theme {
Text(
modifier = Modifier.fillMaxSize().padding(32.dp),
text = "BuildConfig value: ${getValue()}"
)
}
}
}
}
private fun getValue(): Boolean = BuildConfig.BUILD_VALUE
The value is initially show correctly, but if I change the value in build.gradle without editing the activity the value shown is the previous one, not the current one.
Investigating the issue, I see that the decompiled activity correctly updates always the value
public final class MainActivityKt {
private static final boolean getValue() {
return true;
}
…
// OR
public final class MainActivityKt {
private static final boolean getValue() {
return false;
}
….
But if the activity file is not edited, it seems that the linker does not update the newly compiled objectmiguelsesma
06/27/2024, 2:09 PMsemenovalexander
06/27/2024, 5:40 PMmiguelsesma
06/28/2024, 7:48 AMUros Kekovic
07/04/2024, 7:11 PMmiguelsesma
07/05/2024, 8:10 AMmiguelsesma
07/05/2024, 8:11 AMUros Kekovic
07/08/2024, 12:01 PM