Installation
Set up @hotcodepush/react-native-code-push with an AI agent, with npx hotcodepush init or by hand in five steps, then check the setup with doctor.
Install @hotcodepush/react-native-code-push in one of three ways: let an AI agent do it, run npx hotcodepush init, or follow the steps by hand. You need a React Native app on the New Architecture, 0.82 or later (Supported versions), Node to build it and an app in the console.
AI-assisted setup (recommended)
Install the HotCodePush skills:
npx skills add hotcodepush-team/skillsThen paste the prompt into your coding agent:
Set up HotCodePush in this project: install the skills with `npx skills add hotcodepush-team/skills`, then run the hotcodepush-init skill and the hotcodepush-release skill, following https://hotcodepush.com/docs/ai.The agent installs the SDK, creates the app and ships a first update. Agent skills explains what the agent does.
Set up with the CLI
npx hotcodepush initinit installs the package, writes hotcodepush.json, edits both native hosts, wires the build step, runs pod install and signs you in. The init reference lists every step and the manual step it hands you when it cannot edit a file. Run it again after a manual step: it finishes only what is missing.
Manual setup
If init already ran, skip to step 5.
1. Install the package
npm install @hotcodepush/react-native-code-push
npm install --save-dev hotcodepushUse the package manager your lockfile names. The CLI is a dev dependency: the build step runs npx hotcodepush inside every native build. Then name the core's pod inside the app target of ios/Podfile, after use_native_modules!:
target 'YourApp' do
config = use_native_modules!
pod 'HotCodePushCore'
# the rest of the target stays as it is
endInstall the pods:
cd ios && pod install2. Add hotcodepush.json
{
"appId": "4f2b7c9e-8d31-4a6e-9b0f-2c5d7e8a1b34",
"channel": "production"
}appId is on the app's page in the console, and channel is the channel this build follows. Every other key has a default. Configuration lists them.
3. Point both hosts at the SDK
React Native runs the bundle its host hands it, so each native app asks the SDK for it. The edits are one line in the Swift file that overrides bundleURL() and one import in MainApplication.kt. Without these edits a release build runs the embedded bundle and answers every cycle with skipped and build_debug. doctor's host check flags the missing line.
In MainApplication.kt, import the SDK's getDefaultReactHost in place of React Native's. The call and its parameters stay as they are:
import com.hotcodepush.reactnative.HotCodePushReactHost.getDefaultReactHost4. Wire the build step
The build step writes hotcodepush.json into the built app on every build and, in a store build, creates the binary. binary says what it writes and needs. A store build needs npx hotcodepush login or HOTCODEPUSH_TOKEN in the build's environment.
Add one line at the end of android/app/build.gradle:
apply from: new File(["node", "--print", "require.resolve('@hotcodepush/react-native-code-push/package.json')"].execute(null, rootDir).text.trim(), "../android/hotcodepush.gradle")In a build.gradle.kts the same line reads:
apply(from = File(providers.exec { workingDir(rootDir); commandLine("node", "--print", "require.resolve('@hotcodepush/react-native-code-push/package.json')") }.standardOutput.asText.get().trim()).resolveSibling("android/hotcodepush.gradle"))5. Build and verify
Build the app in a release configuration, run it and check the setup:
npx react-native run-ios --mode Release
npx react-native run-android --mode release
npx hotcodepush doctordoctor reports each check as ok, skipped or failed, with the step that repairs a failure. doctor lists the checks.
6. Release a first update
Change something visible, then release it to the channel. release create bundles both platforms itself:
npx hotcodepush release createThe device applies the release at its next start. release has every option. If nothing happens, see Troubleshooting.
Platform notes
- Debug builds ask Metro for their JavaScript, so they embed no bundle and take no updates, whatever
isEnabledInDebugBuildssays. Every cycle answersskippedwithbuild_debug. Test an update in a release build. - Builds: a Release build from Xcode or
run-ioswrites the file and creates no binary, so its first update is the full pack. On iOS only Product › Archive creates the binary, while on Android every build type other thandebugdoes,run-android --mode releaseincluded. - Reloads:
DevSettings.reload(), a restart library and a development reload serve the bundle the host already runs and apply nothing. Anext_startrelease waits for the next process start or forapplyUpdate(). - Android: the SDK's manifest declares
INTERNETandACCESS_NETWORK_STATE, nothing to add. An app that setsandroid:fullBackupContentorandroid:dataExtractionRulesitself hits a manifest merger conflict. Keep your rules, addtools:replacefor the attribute on<application>, and excludehotcodepush/underdomain="file"in both<cloud-backup>and<device-transfer>. - Privacy: the SDK ships its privacy manifest, nothing to add. Privacy and device data has the App Privacy answers.
Next steps
- Configuration lists every key of
hotcodepush.jsonand the strategies that decide when an update is checked, downloaded and applied. - API documents the methods, the events,
useUpdates()and every status and reason a result carries. - Ship every commit has the pipeline that builds, uploads and releases with
HOTCODEPUSH_TOKEN. - Sign your bundles sets up a key pair whose public key goes into
hotcodepush.json, so a device refuses a bundle you did not sign.
Last updated on
React Native
The HotCodePush React Native SDK, @hotcodepush/react-native-code-push, with the one-command setup, the first call and its reference pages.
Configuration
Every hotcodepush.json key the React Native SDK reads, with its type and default, the strategies, the readiness gate and how a change reaches a build.