references/expo-android-integration.md
title: Expo Android Integration impact: HIGH tags: react-native, brownfield, expo, android, aar, reactnativehostmanager
Skill: Expo Android Integration
Package and publish Expo Android AAR, then initialize host runtime and mount RN UI.
Quick Command
npx brownfield package:android --module-name <android_module_name> --variant release
npx brownfield publish:android --module-name <android_module_name>
Record moduleName/variant and the android.expo plugin options in brownfield.config.*
instead of repeating them — see cli-and-config.md for the full option set.
When to Use
- User requests Expo Android brownfield integration
- Host app must consume Expo-backed RN AAR
Prerequisites
- expo-quick-start.md completed
- Android host app builds and syncs
- Android module name resolved (
brownfieldlibby default unless overridden in Expo plugin options)
Agent-Assisted Verification
Use agent-device after the host build succeeds. Read the agent-device skill or CLI help when available before exact commands. If it is missing and verification needs it, install it through the environment's approved/trusted path or ask the user to install or enable it. Then open the host app, navigate to the Expo-backed RN surface, capture snapshots/screenshots, and collect logs for runtime behavior.
Step-by-Step Instructions
Progress checklist:
- [ ] Package AAR
- [ ] Publish to Maven local
- [ ] Initialize host runtime
- [ ] Render RN module
- Build AAR:
npx brownfield package:android --module-name <android_module_name> --variant release
- Publish to Maven local:
npx brownfield publish:android --module-name <android_module_name>
- Initialize runtime in
ActivityorApplication:
ReactNativeHostManager.initialize(application) {
Toast.makeText(this, "React Native has been loaded", Toast.LENGTH_LONG).show()
}
- Forward configuration changes:
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
ReactNativeHostManager.onConfigurationChanged(application, newConfig)
}
- Render RN UI with JS-registered module name:
ReactNativeFragment.createReactNativeFragment("<registered_module_name>", initialProps)- or
ReactNativeBrownfield.shared.createView(activity, "<registered_module_name>", reactDelegate, launchOptions) - in Compose,
AndroidFragment<ReactNativeFragment>with theReactNativeFragmentArgNamesconstants - see runtime-api.md for the full signatures
Stop Conditions
Mark complete only if:
- package and publish commands both exit with code
0 - host app resolves published dependency and renders module
- device evidence is captured with
agent-devicewhen possible
Canonical Docs
Common Pitfalls
- Using
ComponentActivitywith Expo (useAppCompatActivity) - Missing
ReactNativeHostManager.initialize(...)before UI creation - Module name mismatch with
AppRegistry.registerComponent
Related Skills
- cli-and-config.md - Full CLI option set, config file, artifact layout
- runtime-api.md - Host <-> RN API surface
- expo-quick-start.md - Expo setup and plugin wiring
- expo-ios-integration.md - Expo iOS equivalent