RN CodePush failed with exception "No property named "" exists in the "android/gradle.properties" file

189 views Asked by At

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!

1

There are 1 answers

0
Riku On BEST ANSWER

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

appcenter codepush release-react -a [Project] -d Development -t $npm_package_version