Zibi
Zibi

Reputation: 544

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

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

Upvotes: 10

Views: 652

Answers (1)

will
will

Reputation: 871

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.

Upvotes: 6

Related Questions