3

I have set up env variables for my Android and iOS apps to retrieve the information like versionName and versionCode (this is on Android, similar on iOS). It looks something like this for dev:

API_URL=https://linkToApi.com
APP_ID=com.example.test
APP_NAME=App Dev
VERSION_CODE=1.0
VERSION_NAME=1
APP_ICON=ic_launcher

and in app/build.gradle's defaultConfig:

...
applicationId project.env.get("APP_ID")
resValue "string", "app_name", project.env.get("APP_NAME")
versionCode project.env.get("VERSION_CODE").toInteger()
versionName project.env.get("VERSION_NAME")

I build the version correctly and display it on the device just fine, but then I run AppCenter's codepush commands and receive an error.

the command:

codepush release-react -a <my organization name here> -d Production

the error:

Error: Command 'codepush release-react -a <my organization name here> -d Production' failed with exception "No property named "env.get(VERSION_NAME)" exists in the "android/gradle.properties" file."

So, I assume Codepush cannot read the env value and the only way it works if I pass the -t flag with the version I want. The workaround would be to put versionName in the script for package.json file, but I wonder if it is possible for codepush to read the versionName from the env files correctly.

denistepp
  • 489
  • 7
  • 23

0 Answers0