Last active
October 13, 2020 07:39
-
-
Save dyrkow/9b993d794ab01321e0b0bbded9f81b59 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add deps in top | |
import groovy.json.JsonSlurper | |
// Add this function to your android/app/build.gradle | |
def getFromPackage(field) { | |
def inputFile = new File("$rootDir/../package.json") | |
def packageJson = new JsonSlurper().parseText(inputFile.text) | |
return packageJson[field] | |
} | |
// Use function for getting version | |
defaultConfig { | |
... | |
versionCode getFromPackage("version") | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment