buildscript {
    ext {
        buildToolsVersion = "36.0.0"
        minSdkVersion = 24
        compileSdkVersion = 36
        targetSdkVersion = 34
        ndkVersion = "27.1.12297006"
        kotlinVersion = "2.1.20"
        googlePlayServicesVersion = "21.0.1"
        googlePlayServicesMapsVersion = "18.2.0"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:8.13.2')
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
        
        classpath("com.google.gms:google-services:4.4.2")
        classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.9")
    }
}

allprojects {
    repositories {
        mavenCentral()
        google()
        maven { url("$rootDir/../node_modules/react-native/android") }
    }
}

/**
 * ✅ Block 1 – tumhara existing Google Play Services resolution
 */
subprojects {
    configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.google.android.gms') {
                if (details.requested.name == 'play-services-location') {
                    details.useVersion "21.0.1"
                }
            }
        }
    }
}

/**
 * ✅ Block 2 – saare Kotlin Android modules ke liye JVM target 17
 */
subprojects { subproject ->
    subproject.plugins.withId("org.jetbrains.kotlin.android") {
        subproject.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
            kotlinOptions {
                jvmTarget = "17"
            }
        }
    }
}

apply plugin: "com.facebook.react.rootproject"


