react-nativereact-native-code-push

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


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!


Solution

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

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