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