def getVersionCode = { -> try { def stdout = new ByteArrayOutputStream() exec { commandLine 'git', 'rev-list', '--first-parent', '--count', 'master' standardOutput = stdout } return Integer.parseInt(stdout.toString().trim()) } catch (ignored) { return -1; } } def getVersionName = { -> try { def stdout = new ByteArrayOutputStream() exec { commandLine 'git', 'describe', '--tags', '--dirty' standardOutput = stdout } return stdout.toString().trim() } catch (ignored) { return null; } } buildscript { repositories { mavenCentral() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.14.4' classpath 'me.tatarka:gradle-retrolambda:2.5.0' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'me.tatarka.retrolambda' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig { applicationId 'io.trygvis.soilmoisture' minSdkVersion 19 targetSdkVersion 19 versionCode getVersionCode() versionName getVersionName() println("versionCode=$versionCode, versionName=$versionName") } buildTypes { release { // runProguard false // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } lintOptions { // The linter errors out with an NPE. checkReleaseBuilds false abortOnError false } productFlavors { level18 { minSdkVersion 18 applicationId 'io.trygvis.soilmoisture' targetSdkVersion 18 } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile('com.crashlytics.sdk.android:crashlytics:2.1.0@aar') { transitive = true; } compile 'org.sqldroid:sqldroid:1.0.3' compile 'org.flywaydb:flyway-core:3.1' // compile 'net.sourceforge.streamsupport:streamsupport:1.1.2' }