import groovy.json.JsonSlurper def getNpmVersion() { def inputFile = new File(projectDir.getPath() + "/../package.json") def packageJson = new JsonSlurper().parseText(inputFile.text) return packageJson["version"] } def getNpmVersionArray() { // major [0], minor [1], patch [2] def (major, minor, patch) = getNpmVersion().tokenize('.') return [Integer.parseInt(major), Integer.parseInt(minor), Integer.parseInt(patch)] as int[] } buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.2.11394342" kotlinVersion = "1.8.0" googlePlayServicesVisionVersion = "17.0.2" googlePlayServicesVersion = "16.+" firebaseVersion = "17.3.4" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath 'com.google.gms:google-services:4.4.0' classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") classpath 'com.bugsnag:bugsnag-android-gradle-plugin:7.+' } } subprojects {project -> ext { def npmVersion = getNpmVersionArray() versionMajor = npmVersion[0] versionMinor = npmVersion[1] versionPatch = npmVersion[2] } } apply plugin: "com.facebook.react.rootproject"