The build number is available as an Environment variable called BLDZR_BUILD_NUMBER.
Using the build number in a gradle build
In your gradle build file, you can use the following construct to compile the build number into a buildConfigField:
try { buildConfigField 'String', 'BLDZR_BUILD_NUMBER', '\"' + System.getenv("BLDZR_BUILD_NUMBER") + '\"' } catch (MissingPropertyException e) { buildConfigField 'String', 'BLDZR_BUILD_NUMBER', '"Unknown"' }
This will set the buildConfigField BLDZR_BUILD_NUMBER to 'Unknown' when built outside buildozer, and to the buildnumber when building inside buildozer.
Inside your java code you can then access it using:
String buildNumber = BuildConfig.BLDZR_BUILD_NUMBER;
Using the build number in an Xcode build
Todo
0 Comments