xref: /expo/android/app/build.gradle (revision dfd15ebd)
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", 33)
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 175
38    versionName '2.26.0'
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
112dependencies {
113  implementation fileTree(dir: 'libs', include: ['*.jar'])
114
115  implementation 'androidx.multidex:multidex:2.0.0'
116
117  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.6.10')}"
118
119  // Our dependencies
120  implementation ('androidx.appcompat:appcompat:1.4.1')
121
122  // Our dependencies from ExpoView
123  // DON'T ADD ANYTHING HERE THAT ISN'T IN EXPOVIEW. ONLY COPY THINGS FROM EXPOVIEW TO HERE.
124  implementation ('androidx.appcompat:appcompat:1.4.1')
125  compileOnly 'org.glassfish:javax.annotation:3.1.1'
126  implementation 'com.jakewharton:butterknife:10.2.1'
127  implementation 'de.greenrobot:eventbus:2.4.0'
128
129  implementation 'com.squareup.picasso:picasso:2.5.2'
130  implementation 'com.google.android.gms:play-services-analytics:16.0.1'
131  implementation 'com.google.android.gms:play-services-maps:18.0.0'
132  implementation 'com.google.android.gms:play-services-auth:15.0.1'
133  implementation 'com.google.android.gms:play-services-location:15.0.1'
134  debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
135  // debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
136  releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
137  implementation 'com.facebook.device.yearclass:yearclass:2.1.0'
138  implementation 'commons-io:commons-io:1.4'
139  implementation 'me.leolin:ShortcutBadger:1.1.4@aar'
140  implementation 'com.github.CanHub:Android-Image-Cropper:1.1.1'
141  implementation 'commons-codec:commons-codec:1.10'
142  implementation 'com.google.zxing:core:3.3.3'
143  implementation 'net.openid:appauth:0.4.1'
144  implementation 'com.airbnb.android:lottie:3.4.0'
145  implementation('io.nlopez.smartlocation:library:3.2.11') {
146    transitive = false
147  }
148  implementation "androidx.exifinterface:exifinterface:1.0.0"
149  implementation 'com.squareup.okio:okio:1.9.0'
150  implementation 'com.facebook.soloader:soloader:0.8.2'
151  implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
152
153  // expo-file-system
154  implementation 'com.squareup.okhttp3:okhttp:3.10.0'
155  implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
156
157  // Testing
158  androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
159  androidTestImplementation 'androidx.test:runner:1.4.0'
160  androidTestImplementation "androidx.annotation:annotation:1.3.0"
161  androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.0'
162  androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
163  androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'
164
165  androidTestImplementation 'junit:junit:4.12'
166  androidTestImplementation 'org.mockito:mockito-core:1.10.19'
167  testImplementation 'org.robolectric:robolectric:3.8'
168  androidTestImplementation 'androidx.test:runner:1.4.0'
169  androidTestImplementation 'androidx.test:rules:1.4.0'
170
171  testImplementation 'androidx.test:runner:1.4.0'
172  testImplementation 'androidx.test:rules:1.4.0'
173  testImplementation 'junit:junit:4.12'
174  testImplementation 'org.mockito:mockito-core:1.10.19'
175
176  /* UNCOMMENT WHEN DISTRIBUTING
177  implementation('host.exp.exponent:expoview:45.0.0@aar') {
178    transitive = true
179    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
180    exclude group: 'com.squareup.okhttp3', module: 'okhttp-urlconnection'
181  }
182  END UNCOMMENT WHEN DISTRIBUTING */
183
184  // WHEN_DISTRIBUTING_REMOVE_FROM_HERE
185
186  // BEGIN_SDK_UNVERSIONED
187  implementation(project(':expoview'))
188
189  implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
190  // END_SDK_UNVERSIONED
191
192  // WHEN_PREPARING_SHELL_REMOVE_FROM_HERE
193
194  // ADD_NEW_SDKS_HERE
195
196
197  // BEGIN_SDK_47
198  versionedImplementation(project(':expoview-abi47_0_0'))
199  // END_SDK_47
200
201
202  // BEGIN_SDK_46
203  versionedImplementation(project(':expoview-abi46_0_0'))
204  // END_SDK_46
205
206
207  // BEGIN_SDK_45
208  versionedImplementation(project(':expoview-abi45_0_0'))
209  // END_SDK_45
210
211  // This is not needed in shell apps, the Amplitude module will include this dep if installed
212  implementation 'com.amplitude:android-sdk:2.23.2'
213
214  // WHEN_PREPARING_SHELL_REMOVE_TO_HERE
215  // WHEN_DISTRIBUTING_REMOVE_TO_HERE
216
217  /* UNCOMMENT WHEN DISTRIBUTING
218  api 'org.webkit:android-jsc:r250230' // needs to be before react-native
219  api 'com.facebook.react:react-native:+'
220  END UNCOMMENT WHEN DISTRIBUTING */
221
222  // WHEN_DETACHING_REMOVE_FROM_HERE
223  /* UNCOMMENT WHEN DISTRIBUTING
224  implementation project(':expo')
225  implementation 'host.exp.exponent:expo-random:+'
226  END UNCOMMENT WHEN DISTRIBUTING */
227  // WHEN_DETACHING_REMOVE_TO_HERE
228}
229
230// This has to be down here for some reason
231apply plugin: 'com.google.gms.google-services'
232