0

I'm having issues on pushing release via codepush.

Command 'codepush release-react -a [project] -d Development' failed with exception "No property named "getVersionNameFromNpm()" exists in the "android/gradle.properties" file."

On my android/app/build.gradle

def getVersionNameFromNpm() {
    //  Read and parse package.json file from project root
    def inputFile = new File("$rootDir/../package.json")
    def packageJson = new JsonSlurper().parseText(inputFile.text)

    // Return the version, you can get any value this way
    return packageJson["version"]
}

android {
   defaultConfig {
        ...
        versionName getVersionNameFromNpm()
    }
}

Thanks!

Riku
  • 652
  • 1
  • 9
  • 24

1 Answers1

0

I added the version on the script using the $npm_package_version.

appcenter codepush release-react -a [Project] -d Development -t $npm_package_version
Riku
  • 652
  • 1
  • 9
  • 24