Skip to content

Commit

Permalink
Update build.gradle
Browse files Browse the repository at this point in the history
Reviewed Your Gradle Build Script: We looked at your original Gradle build script for the Android library related to Google ML Kit Barcode Scanning.

Made Corrections and Improvements:

Changed rootProject.allprojects to allprojects: Simplified the repository declaration.

Added targetSdkVersion: Included this field in the defaultConfig for better practice.

Simplified Namespace Check: Streamlined the conditional check for the namespace property.

Provided a Revised Script: I shared the corrected version of your Gradle build script with the improvements integrated.
  • Loading branch information
SuryaAbyss authored Oct 31, 2024
1 parent 7d79356 commit b46ee85
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/google_mlkit_barcode_scanning/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
}

rootProject.allprojects {
allprojects {
repositories {
google()
mavenCentral()
Expand All @@ -22,12 +22,12 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
compileSdk 34

// Conditional for compatibility with AGP < 4.2.
if (project.hasProperty("namespace")) {
namespace 'com.google_mlkit_barcode_scanning'
}

compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -36,6 +36,7 @@ android {

defaultConfig {
minSdkVersion 21
targetSdkVersion 34 // It's a good practice to specify targetSdkVersion
}
}

Expand Down

0 comments on commit b46ee85

Please sign in to comment.