//noinspection GradleCompatible apply plugin: 'com.android.application' android { compileSdkVersion 29 def versionPropsFile = file('version.properties') def versionBuild /*Setting default value for versionBuild which is the last incremented value stored in the file */ if (versionPropsFile.canRead()) { Properties versionProps = new Properties() versionProps.load(new FileInputStream(versionPropsFile)) versionBuild = versionProps['VERSION_BUILD'].toInteger() } else { throw new FileNotFoundException("Could not read version.properties!") } /*Wrapping inside a method avoids auto incrementing on every gradle task run. Now it runs only when we build apk*/ ext.autoIncrementBuildNumber = { if (versionPropsFile.canRead()) { Properties versionProps = new Properties() versionProps.load(new FileInputStream(versionPropsFile)) versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1 versionProps['VERSION_BUILD'] = versionBuild.toString() versionProps.store(versionPropsFile.newWriter(), null) } else { throw new FileNotFoundException("Could not read version.properties!") } } defaultConfig { applicationId "net.foucry.pilldroid" minSdkVersion defaultMinSdkVersion targetSdkVersion defaultTargetSdkVersion versionCode 1 versionName "1.0.0." + versionBuild applicationIdSuffix = 'alpha' } buildTypes { release { minifyEnabled false //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } /*dexOptions { incremental false }*/ buildToolsVersion = buildToolsVersion1 allprojects { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } } } repositories { jcenter() } sourceSets { main { java { exclude 'net/foucry/pilldroid/scanActivity.java' } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') testImplementation 'junit:junit:4.13' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'com.google.android.material:material:1.2.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.journeyapps:zxing-android-embedded:4.1.0' implementation 'androidx.appcompat:appcompat:1.2.0' implementation "com.android.support:support-compat:28.0.0" debugImplementation 'com.amitshekhar.android:debug-db:1.0.6' implementation 'za.co.riggaroo:materialhelptutorial:' }