xref: /expo/android/app/build.gradle (revision da751fd5)
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 192
44    versionName '2.29.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      firebaseCrashlytics {
73        nativeSymbolUploadEnabled false
74        mappingFileUploadEnabled false
75      }
76    }
77    release {
78      minifyEnabled true
79      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
80      consumerProguardFiles 'proguard-rules.pro'
81      if (!System.getenv("ANDROID_UNSIGNED")) {
82        signingConfig signingConfigs.release
83      }
84      def shouldUploadCrashlytics = System.getenv("EAS_BUILD") != null
85      firebaseCrashlytics {
86        nativeSymbolUploadEnabled shouldUploadCrashlytics
87        mappingFileUploadEnabled shouldUploadCrashlytics
88      }
89    }
90  }
91
92  flavorDimensions "versioning"
93  productFlavors {
94    versioned {
95      dimension "versioning"
96      manifestPlaceholders = [appLabel:"@string/versioned_app_name"]
97      firebaseCrashlytics {
98        unstrippedNativeLibsDir file("${buildDir}/intermediates/merged_native_libs/versionedRelease/out/lib")
99      }
100    }
101    unversioned {
102      dimension "versioning"
103      getIsDefault().set(true)
104      manifestPlaceholders = [appLabel: "@string/unversioned_app_name"]
105      firebaseCrashlytics {
106        unstrippedNativeLibsDir file("${buildDir}/intermediates/merged_native_libs/unversionedRelease/out/lib")
107      }
108    }
109  }
110
111  // `productFlavors` must be defined before this block
112  defaultConfig {
113    if (android.productFlavors.empty) {
114      // when preparing shell app, the above flavor declarations  are removed
115      // this falls back :expoview to versioned flavor
116      missingDimensionStrategy 'versioning', 'versioned'
117      manifestPlaceholders = [appLabel:"@string/versioned_app_name"]
118    }
119  }
120
121  lintOptions {
122    abortOnError false
123  }
124  packagingOptions {
125    // libfbjni.so is prebuilt library shared between all ABIs
126    pickFirst "lib/**/libfbjni.so"
127    // AGP will give priority of libc++_shared coming from App modules.
128    pickFirst "**/libc++_shared.so"
129  }
130}
131
132dependencies {
133  implementation fileTree(dir: 'libs', include: ['*.jar'])
134
135  implementation 'androidx.multidex:multidex:2.0.0'
136
137  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.6.10')}"
138
139  // Our dependencies
140  implementation ('androidx.appcompat:appcompat:1.4.1')
141
142  // Our dependencies from ExpoView
143  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
144  implementation ('androidx.appcompat:appcompat:1.4.1')
145  compileOnly 'org.glassfish:javax.annotation:3.1.1'
146  implementation 'com.jakewharton:butterknife:10.2.1'
147  implementation 'de.greenrobot:eventbus:2.4.0'
148
149  implementation 'com.squareup.picasso:picasso:2.5.2'
150  implementation 'com.google.android.gms:play-services-analytics:16.0.1'
151  implementation 'com.google.android.gms:play-services-maps:18.0.0'
152  implementation 'com.google.android.gms:play-services-auth:15.0.1'
153  implementation 'com.google.android.gms:play-services-location:15.0.1'
154  debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
155  // debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
156  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
157  implementation 'com.facebook.device.yearclass:yearclass:2.1.0'
158  implementation 'commons-io:commons-io:1.4'
159  implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
160  implementation 'com.github.CanHub:Android-Image-Cropper:1.1.1'
161  implementation 'commons-codec:commons-codec:1.10'
162  implementation 'com.google.zxing:core:3.3.3'
163  implementation 'net.openid:appauth:0.4.1'
164  implementation 'com.airbnb.android:lottie:3.4.0'
165  implementation('io.nlopez.smartlocation:library:3.2.11') {
166    transitive = false
167  }
168  implementation "androidx.exifinterface:exifinterface:1.0.0"
169  implementation 'com.squareup.okio:okio:1.9.0'
170  implementation 'com.facebook.soloader:soloader:0.8.2'
171  implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
172
173  // expo-file-system
174  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
175  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
176
177  // expo-image
178  def GLIDE_VERSION = "4.13.2"
179  kapt "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
180
181  // Testing
182  androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
183  androidTestImplementation 'androidx.test:runner:1.4.0'
184  androidTestImplementation "androidx.annotation:annotation:1.3.0"
185  androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
186  androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
187  androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
188
189  androidTestImplementation 'junit:junit:4.13.2'
190  androidTestImplementation 'org.mockito:mockito-core:1.10.19'
191  testImplementation 'org.robolectric:robolectric:4.10'
192  androidTestImplementation 'androidx.test:runner:1.4.0'
193  androidTestImplementation 'androidx.test:rules:1.4.0'
194
195  testImplementation 'androidx.test:runner:1.4.0'
196  testImplementation 'androidx.test:rules:1.4.0'
197  testImplementation 'junit:junit:4.13.2'
198  testImplementation 'org.mockito:mockito-core:1.10.19'
199
200  // WHEN_DISTRIBUTING_REMOVE_FROM_HERE
201
202  // BEGIN_SDK_UNVERSIONED
203  implementation(project(':expoview'))
204
205  implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
206  // END_SDK_UNVERSIONED
207
208  // ADD_NEW_SDKS_HERE
209
210
211  // BEGIN_SDK_49
212  versionedImplementation(project(':expoview-abi49_0_0'))
213  // END_SDK_49
214
215
216  // BEGIN_SDK_48
217  versionedImplementation(project(':expoview-abi48_0_0'))
218  // END_SDK_48
219
220
221  // BEGIN_SDK_47
222  versionedImplementation(project(':expoview-abi47_0_0'))
223  // END_SDK_47
224}
225
226// This has to be down here for some reason
227apply plugin: 'com.google.gms.google-services'
228
229def ensureCrashlyticsDir = tasks.register('ensureCrashlyticsDir') {
230  doLast {
231    Files.createDirectories(Paths.get("${buildDir}/intermediates/merged_native_libs/versionedRelease/out/lib"))
232    Files.createDirectories(Paths.get("${buildDir}/intermediates/merged_native_libs/unversionedRelease/out/lib"))
233  }
234}
235preBuild.dependsOn(ensureCrashlyticsDir)
236