build.gradle

  1// Top-level build file where you can add configuration options common to all
  2// sub-projects/modules.
  3buildscript {
  4    repositories {
  5        google()
  6        mavenCentral()
  7    }
  8    dependencies {
  9        classpath 'com.android.tools.build:gradle:7.3.1'
 10    }
 11}
 12
 13apply plugin: 'com.android.application'
 14
 15repositories {
 16    google()
 17    mavenCentral()
 18    jcenter()
 19}
 20
 21configurations {
 22    playstoreImplementation
 23    freeImplementation
 24    conversationsFreeImplementation
 25    conversationsPlaystorImplementation
 26    conversationsPlaystoreImplementation
 27    quicksyPlaystoreImplementation
 28    quicksyPlaystoreImplementation
 29    quicksyFreeImplementation
 30    quicksyImplementation
 31}
 32
 33dependencies {
 34    implementation 'androidx.viewpager:viewpager:1.0.0'
 35
 36    playstoreImplementation('com.google.firebase:firebase-messaging:23.1.0') {
 37        exclude group: 'com.google.firebase', module: 'firebase-core'
 38        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 39        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 40    }
 41    conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 42    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
 43    implementation 'org.sufficientlysecure:openpgp-api:10.0'
 44    implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
 45    implementation 'androidx.appcompat:appcompat:1.5.1'
 46    implementation 'androidx.exifinterface:exifinterface:1.3.5'
 47    implementation 'androidx.cardview:cardview:1.0.0'
 48    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 49    implementation 'com.google.android.material:material:1.7.0'
 50
 51    implementation "androidx.emoji2:emoji2:1.2.0"
 52    freeImplementation "androidx.emoji2:emoji2-bundled:1.2.0"
 53
 54    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 55    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 56    //https://github.com/zxing/zxing/issues/1170
 57    implementation 'com.google.zxing:core:3.3.3'
 58    implementation 'de.measite.minidns:minidns-hla:0.2.4'
 59    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 60    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 61    implementation 'com.makeramen:roundedimageview:2.3.0'
 62    implementation "com.wefika:flowlayout:0.4.1"
 63    //noinspection GradleDependency
 64    implementation 'com.otaliastudios:transcoder:0.9.1'
 65
 66    implementation 'org.jxmpp:jxmpp-jid:1.0.3'
 67    implementation 'org.osmdroid:osmdroid-android:6.1.11'
 68    implementation 'org.hsluv:hsluv:0.2'
 69    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 70    implementation 'me.drakeet.support:toastcompat:1.1.0'
 71    implementation "com.leinardi.android:speed-dial:3.2.0"
 72
 73    implementation "com.squareup.retrofit2:retrofit:2.9.0"
 74    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
 75    implementation "com.squareup.okhttp3:okhttp:4.10.0"
 76
 77    implementation 'com.google.guava:guava:31.1-android'
 78    quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.12.49'
 79    freeImplementation 'ch.threema:webrtc-android:100.0.0'
 80    playstoreImplementation fileTree(include: ['libwebrtc-m107.aar'], dir: 'libs')
 81}
 82
 83ext {
 84    travisBuild = System.getenv("TRAVIS") == "true"
 85    preDexEnabled = System.getProperty("pre-dex", "true")
 86    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
 87}
 88
 89android {
 90    namespace 'eu.siacs.conversations'
 91    compileSdkVersion 32
 92
 93    defaultConfig {
 94        minSdkVersion 21
 95        targetSdkVersion 32
 96        versionCode 42039
 97        versionName "2.11.0-beta"
 98        archivesBaseName += "-$versionName"
 99        applicationId "eu.siacs.conversations"
100        resValue "string", "applicationId", applicationId
101        def appName = "Conversations"
102        resValue "string", "app_name", appName
103        buildConfigField "String", "APP_NAME", "\"$appName\"";
104    }
105
106    splits {
107        abi {
108            universalApk true
109            enable true
110        }
111    }
112
113    configurations {
114        implementation.exclude group: 'org.jetbrains' , module:'annotations'
115    }
116
117    dataBinding {
118        enabled true
119    }
120
121    compileOptions {
122        sourceCompatibility JavaVersion.VERSION_1_8
123        targetCompatibility JavaVersion.VERSION_1_8
124    }
125
126    flavorDimensions("mode", "distribution")
127
128    productFlavors {
129
130        quicksy {
131            dimension "mode"
132            applicationId = "im.quicksy.client"
133            resValue "string", "applicationId", applicationId
134
135            def appName = "Quicksy"
136            resValue "string", "app_name", appName
137            buildConfigField "String", "APP_NAME", "\"$appName\"";
138        }
139
140        conversations {
141            dimension "mode"
142        }
143
144        playstore {
145            dimension "distribution"
146            versionNameSuffix "+playstore"
147        }
148        free {
149            dimension "distribution"
150            versionNameSuffix "+free"
151        }
152    }
153
154    sourceSets {
155        quicksyFree {
156            java {
157                srcDir 'src/quicksyFree/java'
158            }
159        }
160        quicksyPlaystore {
161            java {
162                srcDir 'src/quicksyPlaystore/java'
163            }
164            res {
165                srcDir 'src/quicksyPlaystore/res'
166            }
167        }
168        conversationsFree {
169            java {
170                srcDir 'src/conversationsFree/java'
171            }
172        }
173        conversationsPlaystore {
174            java {
175                srcDir 'src/conversationsPlaystore/java'
176            }
177            res {
178                srcDir 'src/conversationsPlaystore/res'
179            }
180        }
181    }
182
183    buildTypes {
184        release {
185            shrinkResources true
186            minifyEnabled true
187            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
188        }
189        debug {
190            shrinkResources true
191            minifyEnabled true
192            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
193        }
194    }
195
196
197    if (new File("signing.properties").exists()) {
198        Properties props = new Properties()
199        props.load(new FileInputStream(file("signing.properties")))
200
201        signingConfigs {
202            release {
203                storeFile file(props['keystore'])
204                storePassword props['keystore.password']
205                keyAlias props['keystore.alias']
206                keyPassword props['keystore.password']
207            }
208        }
209        buildTypes.release.signingConfig = signingConfigs.release
210    }
211
212
213    subprojects {
214
215        afterEvaluate {
216            if (getPlugins().hasPlugin('android') ||
217                    getPlugins().hasPlugin('android-library')) {
218
219                configure(android.lintOptions) {
220                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
221                }
222            }
223
224        }
225    }
226    packagingOptions {
227        resources {
228            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
229        }
230    }
231    lint {
232        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
233    }
234
235    android.applicationVariants.all { variant ->
236        variant.outputs.each { output ->
237            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
238            if (baseAbiVersionCode != null) {
239                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
240            } else {
241                output.versionCodeOverride = 100 * project.android.defaultConfig.versionCode
242            }
243        }
244
245    }
246}