Skip to main content

Choicely RN — Android Integration Guide

Integrate the Choicely React Native SDK into your native Android project. Apps whose screens are built with React Native in Choicely Studio (their navigation links are choicely://rn/...) need this: with android-core alone those screens stay empty.
This guide targets the published SDK artifacts listed below. It is for teams embedding Choicely into an existing native Android app. If you want to build and publish an app without writing code, use Choicely Studio instead.

Versions

React Native 0.82 and its libraries do not build on AGP 9 yet. A new Android Studio project starts on AGP 9: switch it to AGP 8.13.2 as below. Gradle 9.2.1 works. The Gradle plugin is now android-rn-gradle; the old choicely-rn-gradle (0.0.4) is not updated anymore.

Prerequisites

  • Node.js >= 20
  • Android SDK with CMake and NDK 27.1.12297006
  • Git
  • Java 17

Project Structure (after setup)


Setup

Step 1 — Clone the Choicely RN starter

The folder must be named app-react-native by default. To use a different name, set choicelyRnDir in gradle.properties (see Step 2).
npm install also applies the native patches in app-react-native/choicely-android/patches/ and checks them (the starter’s postinstall script).

Step 2 — gradle.properties

A new Android Studio project turns on org.gradle.configuration-cache=true. Leave it on and the build fails with “Starting an external process … apply-rn-patches.js during configuration time is unsupported”.

Step 3 — settings.gradle

Use Groovy build files (settings.gradle, build.gradle): rn-starter reads your app’s namespace from app/build.gradle.
Leave out the template’s dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) } block: React Native libraries declare their own repositories. Declare the repositories in the root build.gradle instead (Step 4).
Why includeBuild and reactSettings can’t be automated by a plugin: They run in Gradle’s settings phase — before any plugin from Maven Central can load. These will always need to be in your settings.gradle.

Step 4 — Root build.gradle


Step 5 — App build.gradle


react-native.config.js

rn-starter already ships app-react-native/react-native.config.js. It reads packageName from the namespace in app/build.gradle, so it needs no edit. If you write your own, the file name must use dots — NOT react-native-config.js:

Step 5b — Required app colours

The Choicely SDK themes reference these. Without them the build can fail at Android resource linking failed … resource color/colorPrimaryDark not found. File: app/src/main/res/values/colors.xml

Step 6 — Application class

Extend ChoicelyRNApplication instead of Application, initialise the Choicely SDK, then call the base initReactNative(appKey). It sets up the React Native host, the generated entry point and the Choicely bridge; do not override it. Set it as android:name of <application> in AndroidManifest.xml, as in the Quick Start.

Bundle loading explained

By default the SDK loads your app’s remote JS bundle — the React Native screens you built in Choicely Studio — from the Choicely server at runtime. Nothing else is needed for that.
Older versions of this page called ChoicelyRNConfig.serLoadRemoteBundle(...) and overrode initReactNative. Neither works with android-rn 0.1.0: the method no longer exists, and the base initReactNative already does what the override did.

Artifacts Overview

Gradle Plugin: com.choicely.sdk:android-rn-gradle

Distributed via Maven Central. Provides two plugin IDs:

Runtime Library: com.choicely.sdk:android-rn

AAR library containing: Transitive dependencies (pulled automatically):
  • com.choicely.sdk:android-core:1.2.2
  • com.facebook.react:react-android:0.82.0
  • com.facebook.react:hermes-android:0.82.0
  • androidx.databinding:*:8.13.2
  • org.jetbrains.kotlin:kotlin-stdlib:2.4.10

Build Commands

The first build compiles native code for every React Native library and takes several minutes; later builds are incremental.

Renaming the RN folder

Change one line in gradle.properties:

What the Gradle plugin handles automatically

What still requires manual setup (Gradle hard limits)


Troubleshooting