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:8.2.0-rc01'
 10    }
 11}
 12
 13apply plugin: 'com.android.application'
 14
 15repositories {
 16    google()
 17    mavenCentral()
 18    maven { url='https://jitpack.io'}
 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    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
 35
 36    implementation 'androidx.viewpager:viewpager:1.0.0'
 37
 38    playstoreImplementation('com.google.firebase:firebase-messaging:23.3.1') {
 39        exclude group: 'com.google.firebase', module: 'firebase-core'
 40        exclude group: 'com.google.firebase', module: 'firebase-analytics'
 41        exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
 42    }
 43    conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2")
 44    quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
 45    implementation 'com.github.open-keychain.open-keychain:openpgp-api:v5.7.1'
 46    implementation("com.github.CanHub:Android-Image-Cropper:2.0.0")
 47    implementation 'androidx.appcompat:appcompat:1.6.1'
 48    implementation 'androidx.exifinterface:exifinterface:1.3.6'
 49    implementation 'androidx.cardview:cardview:1.0.0'
 50    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
 51    implementation 'com.google.android.material:material:1.10.0'
 52
 53    implementation "androidx.emoji2:emoji2:1.4.0"
 54    freeImplementation "androidx.emoji2:emoji2-bundled:1.4.0"
 55
 56    implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
 57    //zxing stopped supporting Java 7 so we have to stick with 3.3.3
 58    //https://github.com/zxing/zxing/issues/1170
 59    implementation 'com.google.zxing:core:3.3.3'
 60    implementation 'de.measite.minidns:minidns-hla:0.2.4'
 61    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
 62    implementation 'org.whispersystems:signal-protocol-java:2.6.2'
 63    implementation 'com.makeramen:roundedimageview:2.3.0'
 64    implementation "com.wefika:flowlayout:0.4.1"
 65    //noinspection GradleDependency
 66    implementation('com.github.natario1:Transcoder:v0.9.1') {
 67        exclude group: 'com.otaliastudios.opengl', module: 'egloo'
 68    }
 69    implementation 'com.github.natario1:Egloo:v0.4.0'
 70
 71    implementation 'org.jxmpp:jxmpp-jid:1.0.3'
 72    implementation 'org.jxmpp:jxmpp-stringprep-libidn:1.0.3'
 73    implementation 'org.osmdroid:osmdroid-android:6.1.11'
 74    implementation 'org.hsluv:hsluv:0.2'
 75    implementation 'org.conscrypt:conscrypt-android:2.5.2'
 76    implementation 'me.drakeet.support:toastcompat:1.1.0'
 77    implementation "com.leinardi.android:speed-dial:3.2.0"
 78
 79    implementation "com.squareup.retrofit2:retrofit:2.9.0"
 80    implementation "com.squareup.retrofit2:converter-gson:2.9.0"
 81    implementation "com.squareup.okhttp3:okhttp:4.11.0"
 82
 83    implementation 'com.google.guava:guava:32.1.3-android'
 84    quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.13.17'
 85    implementation 'im.conversations.webrtc:webrtc-android:119.0.0'
 86}
 87
 88ext {
 89    preDexEnabled = System.getProperty("pre-dex", "true")
 90    abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
 91}
 92
 93android {
 94    namespace 'eu.siacs.conversations'
 95    compileSdk 34
 96
 97    defaultConfig {
 98        minSdkVersion 21
 99        targetSdkVersion 34
100        versionCode 42081
101        versionName "2.13.0"
102        archivesBaseName += "-$versionName"
103        applicationId "eu.siacs.conversations"
104        resValue "string", "applicationId", applicationId
105        def appName = "Conversations"
106        resValue "string", "app_name", appName
107        buildConfigField "String", "APP_NAME", "\"$appName\""
108    }
109
110    splits {
111        abi {
112            universalApk true
113            enable true
114            reset()
115            //noinspection ChromeOsAbiSupport
116            include project.ext.abiCodes.keySet() as String[]
117        }
118    }
119
120    configurations {
121        implementation.exclude group: 'org.jetbrains' , module:'annotations'
122    }
123
124    dataBinding {
125        enabled true
126    }
127
128    compileOptions {
129        coreLibraryDesugaringEnabled true
130        sourceCompatibility JavaVersion.VERSION_17
131        targetCompatibility JavaVersion.VERSION_17
132    }
133
134    flavorDimensions += "mode"
135    flavorDimensions += "distribution"
136
137    productFlavors {
138
139        quicksy {
140            dimension "mode"
141            applicationId = "im.quicksy.client"
142            resValue "string", "applicationId", applicationId
143
144            def appName = "Quicksy"
145            resValue "string", "app_name", appName
146            buildConfigField "String", "APP_NAME", "\"$appName\""
147        }
148
149        conversations {
150            dimension "mode"
151        }
152
153        playstore {
154            dimension "distribution"
155            versionNameSuffix "+playstore"
156        }
157        free {
158            dimension "distribution"
159            versionNameSuffix "+free"
160        }
161    }
162
163    sourceSets {
164        quicksyFree {
165            java {
166                srcDir 'src/quicksyFree/java'
167            }
168        }
169        quicksyPlaystore {
170            java {
171                srcDir 'src/quicksyPlaystore/java'
172            }
173            res {
174                srcDir 'src/quicksyPlaystore/res'
175            }
176        }
177        conversationsFree {
178            java {
179                srcDir 'src/conversationsFree/java'
180            }
181        }
182        conversationsPlaystore {
183            java {
184                srcDir 'src/conversationsPlaystore/java'
185            }
186            res {
187                srcDir 'src/conversationsPlaystore/res'
188            }
189        }
190    }
191
192    buildTypes {
193        release {
194            shrinkResources true
195            minifyEnabled true
196            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
197        }
198        debug {
199            shrinkResources true
200            minifyEnabled true
201            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
202        }
203    }
204
205
206    if (new File("signing.properties").exists()) {
207        Properties props = new Properties()
208        props.load(new FileInputStream(file("signing.properties")))
209
210        signingConfigs {
211            release {
212                storeFile file(props['keystore'])
213                storePassword props['keystore.password']
214                keyAlias props['keystore.alias']
215                keyPassword props['keystore.password']
216            }
217        }
218        buildTypes.release.signingConfig = signingConfigs.release
219    }
220
221
222    subprojects {
223
224        afterEvaluate {
225            if (getPlugins().hasPlugin('android') ||
226                    getPlugins().hasPlugin('android-library')) {
227
228                configure(android.lintOptions) {
229                    disable 'AndroidGradlePluginVersion', 'MissingTranslation'
230                }
231            }
232
233        }
234    }
235    packagingOptions {
236        resources {
237            excludes += ['META-INF/BCKEY.DSA', 'META-INF/BCKEY.SF']
238        }
239    }
240    lint {
241        disable 'MissingTranslation', 'InvalidPackage', 'AppCompatResource'
242    }
243    buildFeatures {
244        buildConfig true
245    }
246
247    android.applicationVariants.configureEach { variant ->
248        variant.outputs.each { output ->
249            def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
250            if (baseAbiVersionCode != null) {
251                output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
252            } else {
253                output.versionCodeOverride = 100 * project.android.defaultConfig.versionCode
254            }
255        }
256
257    }
258}