zbx
zbx

Reputation: 289

Setting constant value buildConfigField in Gradle when assembling production version

I have defined the following buildConfigField under productFlavors in my gradle file:

buildConfigField "java.util.Date", "buildTime", "new java.util.Date(" + System.currentTimeMillis() + "L)"

My question is will this field change each time they open up an app or only when it's first build/ installed on their device? If yes, how do I make it a constant?

Sorry for such a stupid question, I'm new at working with gradle. Any help appreciated

Upvotes: 0

Views: 293

Answers (1)

Vampire
Vampire

Reputation: 38724

You execute the System.currentTimeMillis() call in Gradle when your project is built and then set buildTime to something like new java.util.Date(1483522309324L), so the value is already a constant in your project that is calculated fixely at build time as its name suggests.

Upvotes: 1

Related Questions