diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index ea7165d4d5..3f2b90bc6d 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -1,5 +1,3 @@ -import org.apache.tools.ant.taskdefs.condition.Os - apply plugin: 'com.android.application' android { @@ -96,12 +94,15 @@ dependencies { } def getVersion() { - String result - if(Os.isFamily(Os.FAMILY_WINDOWS)) { - result = 'cmd /c git describe --always --long'.execute([], project.rootDir).text - } else { - result = 'git describe --always --long'.execute([], project.rootDir).text + def versionNumber = '0.0' + + try { + versionNumber = 'git describe --always --long'.execute([], project.rootDir).text + .trim() + .replaceAll(/(-0)?-[^-]+$/, "") + } catch (Exception e) { + logger.error('Cannot find git, defaulting to dummy version number') } - return result.trim().replaceAll(/(-0)?-[^-]+$/, "") + return versionNumber }