apply plugin: 'com.android.application' static def getPackageName() { return "org.linphone" } static def firebaseEnabled() { File googleFile = new File('app/google-services.json') return googleFile.exists() } static def isLocalAarAvailable() { File debugAar = new File('linphone-sdk-android/linphone-sdk-android-debug.aar') File releaseAar = new File('linphone-sdk-android/linphone-sdk-android-release.aar') return debugAar.exists() || releaseAar.exists() } ///// Exclude Files ///// def excludeFiles = [] if (!firebaseEnabled()) { excludeFiles.add('**/Firebase*') println '[Push Notification] Firebase disabled' } def excludePackage = [] excludePackage.add('**/gdb.*') excludePackage.add('**/libopenh264**') excludePackage.add('**/**tester**') excludePackage.add('**/LICENSE.txt') ///////////////////////// repositories { maven { // Switch to release for releases ! url "https://gitlab.linphone.org/BC/public/maven_repository/raw/tmp/lime_v2" } } android { lintOptions { abortOnError false } compileSdkVersion 28 defaultConfig { minSdkVersion 21 targetSdkVersion 28 versionCode 4108 versionName "4.1" applicationId getPackageName() multiDexEnabled true } applicationVariants.all { variant -> variant.outputs.all { outputFileName = "linphone-android-${variant.buildType.name}-${defaultConfig.versionName}.apk" } } def keystorePropertiesFile = rootProject.file("keystore.properties") def keystoreProperties = new Properties() keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) signingConfigs { release { storeFile file(keystoreProperties['storeFile']) storePassword keystoreProperties['storePassword'] keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] } } buildTypes { release { minifyEnabled true signingConfig signingConfigs.release proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' resValue "string", "sync_account_type", getPackageName() + ".sync" resValue "string", "file_provider", getPackageName() + ".provider" resValue "string", "sync_mimetype", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" } debug { applicationIdSuffix ".debug" debuggable true jniDebuggable true versionNameSuffix '-debug' resValue "string", "sync_account_type", getPackageName() + ".sync" resValue "string", "file_provider", getPackageName() + ".provider" resValue "string", "sync_mimetype", "vnd.android.cursor.item/vnd." + getPackageName() + ".provider.sip_address" } } sourceSets { main { packagingOptions { excludes = excludePackage } } } packagingOptions { pickFirst 'META-INF/NOTICE' pickFirst 'META-INF/LICENSE' exclude 'META-INF/MANIFEST.MF' } } dependencies { implementation 'com.google.firebase:firebase-messaging:17.3.4' implementation 'com.android.billingclient:billing:1.2' implementation 'org.apache.commons:commons-compress:1.18' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.appcompat:appcompat:1.0.2' implementation 'com.google.android.material:material:1.1.0-alpha01' implementation 'com.google.android:flexbox:1.1.0' if (isLocalAarAvailable()) { implementation project(":linphone-sdk-android") } else { implementation "org.linphone:linphone-sdk-android:4.1+" } } if (firebaseEnabled()) { apply plugin: 'com.google.gms.google-services' } apply plugin: "com.diffplug.gradle.spotless" spotless { java { target '**/*.java' googleJavaFormat('1.6').aosp() removeUnusedImports() } } project.tasks['preBuild'].dependsOn 'spotlessApply'