adding code push key react native android

1.3k Views Asked by At

I am using react native above 0.60 and I was trying to generate the release apk and uploaded it to google play so I added the code push key of production in buildTypes like this:

buildTypes {
      
        release {
            buildConfigField "String", "CODEPUSH_KEY", 'production_key'
        }
    }

and I totally forget to change the code push key in android/app/src/main/res/values/strings.xml from staging to production

<resources>
    <string name="app_name">app_name</string>
    <string moduleConfig="true" name="CodePushDeploymentKey">staging_key</string>
</resources>

so which key will be applied? the one in buildTypes or the on in strigs.xml?

1

There are 1 best solutions below

0
On BEST ANSWER

The one in the strings.xml. From the docs:

https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md

Add the Deployment key to strings.xml:

To let the CodePush runtime know which deployment it should query for updates, open your app's strings.xml file and add a new string named CodePushDeploymentKey, whose value is the key of the deployment you want to configure this app against (like the key for the Staging deployment for the FooBar app). You can retrieve this value by running appcenter codepush deployment list -a / -k in the CodePush CLI (the -k flag is necessary since keys aren't displayed by default) and copying the value of the Key column which corresponds to the deployment you want to use (see below). Note that using the deployment's name (like Staging) will not work. The "friendly name" is intended only for authenticated management usage from the CLI, and not for public consumption within your app