This gradle snippet setup auto management of versionCode
and versionName
using tags found on your git repository.
- When building an apk from a commit tagged
v1.4.2
, thenversionName
will bev1.4.2
- When building an apk from a commit
abcd123
which is the 3rd one after tagv1.5.7
, thenversionName
will bev1.5.7-3-gabcd123
versionCode
is automatically handled givenversionName
value
Just add a tag in your git repository name like v1.4.2
.