BuildConfig.VERSION_NAME not updating in code after modifying build.gradle and syncing project
Asked Answered
G

1

8

I'm experiencing an issue with BuildConfig.VERSION_NAME in my code. When I change the version name in the build.gradle file and sync the project, the change isn't reflected in my code. Instead, the code continues to display the previous version name until I either rebuild the entire project or make some change to the project code.

I've checked the generated BuildConfig class, and it shows the new version name correctly. However, when I log the BuildConfig.VERSION_NAME value, it still shows the old one.

Does anyone know why this is happening or how to fix it?

Also, I have recently updated the targetSdk to 34, gradle version to 8.4 and kotlin version to 2.0

Guyguyana answered 2/7 at 15:6 Comment(4)
did you find why this is happening?Santana
Also encountering this very annoying issue. were you able to fix this?Sidewinder
@Santana It's happening because of the new Kotlin version - 2.0.0 in my case.Guyguyana
@Sidewinder I haven't found any better solutions other than downgrading the Kotlin version to 1.9.24.Guyguyana
B
4

I solved this by disabling incremental compilation .

In your project's gradle.properties file, add kotlin.incremental=false. Now, when I edit the version name, it's reflected in the next app build/launch.

Bait answered 10/7 at 14:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.