xref: /expo/android/app/build.gradle (revision ae642c8a)
1import java.nio.file.Files
2import java.nio.file.Paths
3
4apply plugin: 'kotlin-kapt'
5
6buildscript {
7  // Simple helper that allows the root project to override versions declared by this library.
8  ext.safeExtGet = { prop, fallback ->
9    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
10  }
11
12  repositories {
13    google()
14    mavenCentral()
15  }
16
17  dependencies {
18    classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.6.10')}")
19  }
20}
21apply plugin: 'com.android.application'
22apply plugin: 'kotlin-android'
23apply plugin: 'com.google.firebase.crashlytics'
24
25android {
26  compileSdkVersion safeExtGet("compileSdkVersion", 33)
27
28  compileOptions {
29    sourceCompatibility JavaVersion.VERSION_11
30    targetCompatibility JavaVersion.VERSION_11
31  }
32
33  kotlinOptions {
34    jvmTarget = JavaVersion.VERSION_11.majorVersion
35  }
36
37  defaultConfig {
38    applicationId 'host.exp.exponent'
39    minSdkVersion safeExtGet("minSdkVersion", 21)
40    targetSdkVersion safeExtGet("targetSdkVersion", 33)
41    // ADD VERSIONS HERE
42    // BEGIN VERSIONS
43    versionCode 183
44    versionName '2.28.0'
45    // END VERSIONS
46
47    multiDexEnabled true
48    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
49    // Deprecated. Used by net.openid:appauth
50    manifestPlaceholders = [
51        'appAuthRedirectScheme': 'host.exp.exponent'
52    ]
53  }
54  dexOptions {
55    javaMaxHeapSize System.getenv("DISABLE_DEX_MAX_HEAP") ? null : "8g"
56  }
57
58  signingConfigs {
59    debug {
60      storeFile file('../debug.keystore')
61    }
62    release {
63      storeFile file(System.getenv("ANDROID_KEYSTORE_PATH") ?: "release-key.jks")
64      storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
65      keyAlias System.getenv("ANDROID_KEY_ALIAS")
66      keyPassword System.getenv("ANDROID_KEY_PASSWORD")
67    }
68  }
69  buildTypes {
70    debug {
71      debuggable true
72    }
73    release {
74      minifyEnabled true
75      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
76      consumerProguardFiles 'proguard-rules.pro'
77      if (!System.getenv("ANDROID_UNSIGNED")) {
78        signingConfig signingConfigs.release
79      }
80      firebaseCrashlytics {
81        nativeSymbolUploadEnabled true
82      }
83    }
84  }
85
86  flavorDimensions "versioning"
87  productFlavors {
88    versioned {
89      dimension "versioning"
90      manifestPlaceholders = [appLabel:"@string/versioned_app_name"]
91      firebaseCrashlytics {
92        unstrippedNativeLibsDir file("${buildDir}/intermediates/merged_native_libs/versionedRelease/out/lib")
93      }
94    }
95    unversioned {
96      dimension "versioning"
97      getIsDefault().set(true)
98      manifestPlaceholders = [appLabel: "@string/unversioned_app_name"]
99      firebaseCrashlytics {
100        unstrippedNativeLibsDir file("${buildDir}/intermediates/merged_native_libs/unversionedRelease/out/lib")
101      }
102    }
103  }
104
105  // `productFlavors` must be defined before this block
106  defaultConfig {
107    if (android.productFlavors.empty) {
108      // when preparing shell app, the above flavor declarations  are removed
109      // this falls back :expoview to versioned flavor
110      missingDimensionStrategy 'versioning', 'versioned'
111      manifestPlaceholders = [appLabel:"@string/versioned_app_name"]
112    }
113  }
114
115  lintOptions {
116    abortOnError false
117  }
118  packagingOptions {
119    // libfbjni.so is prebuilt library shared between all ABIs
120    pickFirst "lib/**/libfbjni.so"
121    // AGP will give priority of libc++_shared coming from App modules.
122    pickFirst "**/libc++_shared.so"
123  }
124}
125
126dependencies {
127  implementation fileTree(dir: 'libs', include: ['*.jar'])
128
129  implementation 'androidx.multidex:multidex:2.0.0'
130
131  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.6.10')}"
132
133  // Our dependencies
134  implementation ('androidx.appcompat:appcompat:1.4.1')
135
136  // Our dependencies from ExpoView
137  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
138  implementation ('androidx.appcompat:appcompat:1.4.1')
139  compileOnly 'org.glassfish:javax.annotation:3.1.1'
140  implementation 'com.jakewharton:butterknife:10.2.1'
141  implementation 'de.greenrobot:eventbus:2.4.0'
142
143  implementation 'com.squareup.picasso:picasso:2.5.2'
144  implementation 'com.google.android.gms:play-services-analytics:16.0.1'
145  implementation 'com.google.android.gms:play-services-maps:18.0.0'
146  implementation 'com.google.android.gms:play-services-auth:15.0.1'
147  implementation 'com.google.android.gms:play-services-location:15.0.1'
148  debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
149  // debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
150  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
151  implementation 'com.facebook.device.yearclass:yearclass:2.1.0'
152  implementation 'commons-io:commons-io:1.4'
153  implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
154  implementation 'com.github.CanHub:Android-Image-Cropper:1.1.1'
155  implementation 'commons-codec:commons-codec:1.10'
156  implementation 'com.google.zxing:core:3.3.3'
157  implementation 'net.openid:appauth:0.4.1'
158  implementation 'com.airbnb.android:lottie:3.4.0'
159  implementation('io.nlopez.smartlocation:library:3.2.11') {
160    transitive = false
161  }
162  implementation "androidx.exifinterface:exifinterface:1.0.0"
163  implementation 'com.squareup.okio:okio:1.9.0'
164  implementation 'com.facebook.soloader:soloader:0.8.2'
165  implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
166
167  // expo-file-system
168  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
169  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
170
171  // expo-image
172  def GLIDE_VERSION = "4.13.2"
173  kapt "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
174
175  // Testing
176  androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
177  androidTestImplementation 'androidx.test:runner:1.4.0'
178  androidTestImplementation "androidx.annotation:annotation:1.3.0"
179  androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
180  androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
181  androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
182
183  androidTestImplementation 'junit:junit:4.13.2'
184  androidTestImplementation 'org.mockito:mockito-core:1.10.19'
185  testImplementation 'org.robolectric:robolectric:4.10'
186  androidTestImplementation 'androidx.test:runner:1.4.0'
187  androidTestImplementation 'androidx.test:rules:1.4.0'
188
189  testImplementation 'androidx.test:runner:1.4.0'
190  testImplementation 'androidx.test:rules:1.4.0'
191  testImplementation 'junit:junit:4.13.2'
192  testImplementation 'org.mockito:mockito-core:1.10.19'
193
194  // WHEN_DISTRIBUTING_REMOVE_FROM_HERE
195
196  // BEGIN_SDK_UNVERSIONED
197  implementation(project(':expoview'))
198
199  implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
200  // END_SDK_UNVERSIONED
201
202  // ADD_NEW_SDKS_HERE
203
204
205  // BEGIN_SDK_48
206  versionedImplementation(project(':expoview-abi48_0_0'))
207  // END_SDK_48
208
209
210  // BEGIN_SDK_47
211  versionedImplementation(project(':expoview-abi47_0_0'))
212  // END_SDK_47
213
214
215  // BEGIN_SDK_46
216  versionedImplementation(project(':expoview-abi46_0_0'))
217  // END_SDK_46
218}
219
220// This has to be down here for some reason
221apply plugin: 'com.google.gms.google-services'
222
223def ensureCrashlyticsDir = tasks.register('ensureCrashlyticsDir') {
224  doLast {
225    Files.createDirectories(Paths.get("${buildDir}/intermediates/merged_native_libs/versionedRelease/out/lib"))
226    Files.createDirectories(Paths.get("${buildDir}/intermediates/merged_native_libs/unversionedRelease/out/lib"))
227  }
228}
229preBuild.dependsOn(ensureCrashlyticsDir)
230