|
| 1 | +import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties |
| 2 | + |
| 3 | +plugins { |
| 4 | + alias(libs.plugins.android.application) |
| 5 | + alias(libs.plugins.kotlin.android) |
| 6 | + alias(libs.plugins.kotlin.kapt) |
| 7 | + alias(libs.plugins.dagger.hilt.android) |
| 8 | + alias(libs.plugins.navigation.safeargs) |
| 9 | + alias(libs.plugins.google.services) |
| 10 | + alias(libs.plugins.firebase.crashlytics) |
| 11 | +} |
| 12 | + |
| 13 | +val storeFileProvider: String = gradleLocalProperties(rootDir, providers).getProperty("storeFile") |
| 14 | +val storePasswordProvider: String = gradleLocalProperties(rootDir, providers).getProperty("storePassword") |
| 15 | +val keyAliasProvider: String = gradleLocalProperties(rootDir, providers).getProperty("keyAlias") |
| 16 | +val keyPasswordProvider: String = gradleLocalProperties(rootDir, providers).getProperty("keyPassword") |
| 17 | + |
| 18 | +android { |
| 19 | + namespace = "com.arindam.camerax" |
| 20 | + compileSdk = rootProject.extra["compileSdk"] as Int |
| 21 | + |
| 22 | + signingConfigs { |
| 23 | + create("release") { |
| 24 | + storeFile = file(storeFileProvider) |
| 25 | + storePassword = storePasswordProvider |
| 26 | + keyAlias = keyAliasProvider |
| 27 | + keyPassword = keyPasswordProvider |
| 28 | + } |
| 29 | + } |
| 30 | + |
| 31 | + defaultConfig { |
| 32 | + applicationId = "com.arindam.camerax" |
| 33 | + minSdk = rootProject.extra["minSdkVersion"] as Int |
| 34 | + targetSdk = rootProject.extra["targetSdkVersion"] as Int |
| 35 | + versionCode = rootProject.extra["versionCodeBase"] as Int |
| 36 | + versionName = rootProject.extra["versionNameBase"] as String |
| 37 | + vectorDrawables.useSupportLibrary = true |
| 38 | + signingConfig = signingConfigs.getByName("release") |
| 39 | + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 40 | + ndk.abiFilters.addAll(listOf("armeabi-v7a", "arm64-v8a", "x86", "x86_64") ) |
| 41 | + } |
| 42 | + |
| 43 | + buildTypes { |
| 44 | + getByName("debug") { |
| 45 | + applicationIdSuffix = ".debug" |
| 46 | + resValue("string", "app_version", "${defaultConfig.versionName} (build ${defaultConfig.versionCode}$applicationIdSuffix)") |
| 47 | + resValue("string", "app_name", "CameraX [D]") |
| 48 | + isMinifyEnabled = false |
| 49 | + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") |
| 50 | + } |
| 51 | + getByName("release") { |
| 52 | + resValue("string", "app_version", "${defaultConfig.versionName} (build ${defaultConfig.versionCode}.release)") |
| 53 | + resValue("string", "app_name", "CameraX") |
| 54 | + isMinifyEnabled = true |
| 55 | + isShrinkResources = true |
| 56 | + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") |
| 57 | + ndk.debugSymbolLevel = "SYMBOL_TABLE" |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + buildFeatures { |
| 62 | + buildConfig = true |
| 63 | + viewBinding = true |
| 64 | + compose = true |
| 65 | + } |
| 66 | + |
| 67 | + compileOptions { |
| 68 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 69 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 70 | + } |
| 71 | + |
| 72 | + kotlinOptions { |
| 73 | + jvmTarget = "1.8" |
| 74 | + } |
| 75 | + |
| 76 | + composeOptions { |
| 77 | + kotlinCompilerExtensionVersion = "1.5.14" |
| 78 | + } |
| 79 | + |
| 80 | + packaging { |
| 81 | + resources { |
| 82 | + excludes += "/META-INF/{AL2.0,LGPL2.1}" |
| 83 | + } |
| 84 | + } |
| 85 | + |
| 86 | + // Set the source of tests to same for both Unit and Instrumented tests |
| 87 | + /*sourceSets { |
| 88 | + String sharedTestDir = 'src/test/java' |
| 89 | + test { |
| 90 | + java.srcDir sharedTestDir |
| 91 | + } |
| 92 | + androidTest { |
| 93 | + java.srcDir sharedTestDir |
| 94 | + } |
| 95 | + }*/ |
| 96 | + |
| 97 | + // Necessary for Robolectric (Unit tests) |
| 98 | + /*testOptions { |
| 99 | + unitTests { |
| 100 | + includeAndroidResources = true |
| 101 | + } |
| 102 | + }*/ |
| 103 | +} |
| 104 | + |
| 105 | +dependencies { |
| 106 | + // AndroidX |
| 107 | + implementation(libs.androidx.core.ktx) |
| 108 | + implementation(libs.androidx.core.splashscreen) |
| 109 | + implementation(libs.androidx.appcompat) |
| 110 | + implementation(libs.androidx.fragment.ktx) |
| 111 | + implementation(libs.androidx.constraintlayout) |
| 112 | + implementation(libs.androidx.localbroadcastmanager) |
| 113 | + implementation(libs.androidx.preference.ktx) |
| 114 | + |
| 115 | + // Lifecycle and LiveData |
| 116 | + implementation(libs.androidx.lifecycle.runtime.ktx) |
| 117 | + |
| 118 | + // Navigation library |
| 119 | + implementation(libs.androidx.navigation.fragment.ktx) |
| 120 | + implementation(libs.androidx.navigation.ui.ktx) |
| 121 | + |
| 122 | + // CameraX |
| 123 | + implementation(libs.androidx.camera.core) |
| 124 | + implementation(libs.androidx.camera.camera2) |
| 125 | + implementation(libs.androidx.camera.lifecycle) |
| 126 | + implementation(libs.androidx.camera.video) |
| 127 | + implementation(libs.androidx.camera.view) |
| 128 | + implementation(libs.androidx.camera.extensions) |
| 129 | + |
| 130 | + // EXIF |
| 131 | + implementation(libs.androidx.exifinterface) |
| 132 | + |
| 133 | + // Coil |
| 134 | + implementation(libs.coil.compose) |
| 135 | + |
| 136 | + // Material Design |
| 137 | + implementation(libs.material) |
| 138 | + |
| 139 | + // Lottie |
| 140 | + implementation(libs.lottie) |
| 141 | + |
| 142 | + // Firebase SDK |
| 143 | + implementation(libs.firebase.analytics.ktx) |
| 144 | + implementation(libs.firebase.crashlytics) |
| 145 | + |
| 146 | + // [CONFLICT FIX] Guava |
| 147 | + api(libs.guava) |
| 148 | + |
| 149 | + // Compose |
| 150 | + implementation(platform(libs.androidx.compose.bom)) |
| 151 | + androidTestImplementation(platform(libs.androidx.compose.bom)) |
| 152 | + |
| 153 | + // [VERIFY] |
| 154 | + implementation(libs.androidx.ui) |
| 155 | + implementation(libs.androidx.ui.graphics) |
| 156 | + implementation(libs.androidx.ui.tooling.preview) |
| 157 | + |
| 158 | + // Compose Material Design 3 |
| 159 | + implementation(libs.compose.material3) |
| 160 | + |
| 161 | + // Android Studio Preview support |
| 162 | + implementation(libs.compose.ui.tooling.preview) |
| 163 | + debugImplementation(libs.compose.ui.tooling) |
| 164 | + |
| 165 | + // UI Tests |
| 166 | + androidTestImplementation(libs.compose.ui.test.junit4) |
| 167 | + debugImplementation(libs.compose.ui.test.manifest) |
| 168 | + |
| 169 | + // Optional - Included automatically by material, only add when you need |
| 170 | + // the icons but not the material library (e.g. when using Material3 or a |
| 171 | + // custom design system based on Foundation) |
| 172 | + implementation(libs.compose.material.icons.core) |
| 173 | + // Optional - Add full set of material icons |
| 174 | + implementation(libs.compose.material.icons.extended) |
| 175 | + // Optional - Add window size utils |
| 176 | + //implementation(libs.compose.material3.window.size) |
| 177 | + |
| 178 | + // Optional - Integration with activities |
| 179 | + implementation(libs.androidx.activity.compose) |
| 180 | + // Optional - Integration with ViewModels |
| 181 | + //implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") |
| 182 | + // Optional - Integration with LiveData |
| 183 | + //implementation("androidx.compose.runtime:runtime-livedata") |
| 184 | + // Optional - Integration with RxJava |
| 185 | + //implementation("androidx.compose.runtime:runtime-rxjava2") |
| 186 | + |
| 187 | + implementation(libs.androidx.paging.compose) |
| 188 | + |
| 189 | + // Hilt |
| 190 | + implementation(libs.dagger.hilt.android) |
| 191 | + kapt(libs.dagger.hilt.compiler) |
| 192 | + |
| 193 | + // Unit testing |
| 194 | + testImplementation(libs.androidx.junit) |
| 195 | + testImplementation(libs.androidx.rules) |
| 196 | + testImplementation(libs.androidx.runner) |
| 197 | + testImplementation(libs.androidx.espresso.core) |
| 198 | + testImplementation(libs.robolectric) |
| 199 | + |
| 200 | + // Instrumented testing |
| 201 | + androidTestImplementation(libs.androidx.junit) |
| 202 | + androidTestImplementation(libs.androidx.rules) |
| 203 | + androidTestImplementation(libs.androidx.runner) |
| 204 | + androidTestImplementation(libs.androidx.espresso.core) |
| 205 | +} |
0 commit comments