android/app/build.gradle (other config removed for clarity):def getVersionName = { ->
return project.hasProperty('versionName') ? versionName : "0.0.1"
}
android {
defaultConfig {
versionName getVersionName()
}
}
react-native run-android
appcenter codepush release-react -a <app_name>
The release is created.
The release fails with error:
Detecting android app version:
Error: Command 'codepush release-react -a will.morton-1/Scoot-Android' failed with exception "No property named "getVersionName()" exists in the "android/gradle.properties" file."
Changing the versionName to a static string removes the error, so the issue appears to be that the bundler is not interpreting the file as gradle but rather grepping for the value - this is at odds with the react-native build system itself.
This error suggests that codepush will not support any dynamic methods within a build.gradle file, which is a fairly major limitation.
Hi @willmortonscoot
Unfortunately we can't execute getVersionName() but CLI require version.
To avoid this error you should use -t|--target-binary-version option:
appcenter codepush release-react -a <app_name> -t <version>
Thanks!
Most helpful comment
Hi @willmortonscoot
Unfortunately we can't execute
getVersionName()but CLI require version.To avoid this error you should use
-t|--target-binary-versionoption:Thanks!