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