diff --git a/react-native/android/publish_android_template b/react-native/android/publish_android_template index 16556063..6118b1fd 100644 --- a/react-native/android/publish_android_template +++ b/react-native/android/publish_android_template @@ -66,9 +66,17 @@ String getAppId () { apply from: 'analytics.gradle' +import groovy.json.JsonSlurper + +def getNpmVersion() { + def inputFile = new File(buildscript.sourceFile.getParent() + "/../package.json") + def packageJson = new JsonSlurper().parseText(inputFile.text) + return packageJson["version"] +} + task send(type: SendAnalyticsTask) { applicationId = getAppId() - version = "npm --silent run get-version".execute(null, projectDir).text.trim() + version = getNpmVersion().trim() } preBuild.dependsOn send