def safeExtGet(prop, fallback) { rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback } buildscript { repositories { mavenCentral() maven { url 'https://maven.google.com/' name 'Google' } } dependencies { classpath 'com.android.tools.build:gradle:9.2.1' } // ponytail: AGP 9.2.1 still drags in these three CVE-flagged transitive versions // unchanged (nothing else in the buildscript classpath forces a newer one) — force // patched versions directly instead of chasing a Gradle-wrapper-wide AGP major bump. configurations.classpath { resolutionStrategy { force 'org.bouncycastle:bcprov-jdk18on:1.81.1' force 'org.bouncycastle:bcpkix-jdk18on:1.81.1' force 'org.bouncycastle:bcutil-jdk18on:1.81.1' force 'org.jdom:jdom2:2.0.6.1' force 'org.bitbucket.b_c:jose4j:0.9.6' } } } apply plugin: 'com.android.library' // AGP 9 registers the `kotlin` extension itself; applying kotlin-android on top collides with it. if (project.extensions.findByName('kotlin') == null) { apply plugin: 'kotlin-android' } apply plugin: 'com.facebook.react' def includeConnector = project.hasProperty('appsflyer.enable_purchase_connector') ? project.property('appsflyer.enable_purchase_connector').toBoolean() : false android { namespace "com.appsflyer.reactnative" compileSdkVersion safeExtGet('compileSdkVersion', 34) buildToolsVersion safeExtGet('buildToolsVersion', '34.0.0') buildFeatures { buildConfig = true } defaultConfig { minSdkVersion safeExtGet('minSdkVersion', 21) targetSdkVersion safeExtGet('targetSdkVersion', 34) ndk { abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" } buildConfigField 'boolean', 'INCLUDE_CONNECTOR', includeConnector.toString() } sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/kotlin', 'src/main/common'] java.srcDirs += includeConnector ? ['src/main/includeConnector'] : ['src/main/excludeConnector'] } } lintOptions { warning 'InvalidPackage' } testOptions { unitTests.includeAndroidResources = true unitTests.returnDefaultValues = true // ponytail: no unit tests remain now that RpcInitGate.kt is gone (bridge module is a pure // passthrough); avoid Gradle 8+ failing the build on an empty test source set. Add tests // back here (and drop this) if real branching logic returns to this module. unitTests.all { it.failOnNoDiscoveredTests = false } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } // AGP 9: android.kotlinOptions unsupported; top-level works for both topologies. kotlin { compilerOptions { jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 } } repositories { mavenCentral() maven { url "https://maven.google.com" } } dependencies { implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.2')}" if (includeConnector){ implementation 'com.appsflyer:purchase-connector:2.3.0' } implementation platform('com.appsflyer:af-android-sdk-bom:7.0.4') implementation 'com.appsflyer:af-android-sdk' // pinned explicitly — af-android-sdk-bom (7.0.1) doesn't carry this version yet implementation 'com.appsflyer:af-android-plugin-bridge:7.0.13' testImplementation 'junit:junit:4.13.2' // android.jar's org.json stub throws/returns null for every method under // testOptions.unitTests.returnDefaultValues — pull in the real implementation so // JSON-based logic (e.g. RNAppsFlyerModule's event normalization) is actually exercised. testImplementation 'org.json:json:20231013' }