Software Mansion Mariusz Stanisz Dec 13, 2024

Adding React Native to Signal Open Source App: Part 2 (Android)

Article Summary

Mariusz Stanisz from Software Mansion just cracked the Android side of brownfield React Native integration. If you thought iOS was tricky, wait until you see the Gradle gymnastics required for Signal's Android app.

This is part 2 of integrating React Native into Signal's open source app, focusing entirely on Android. While iOS had its challenges, the Android implementation required deeper build script modifications, strategic repository restructuring, and careful Activity setup to get React Native running in a production brownfield environment.

Key Takeaways

Critical Insight

Android brownfield integration requires more build script manipulation than iOS, but the actual Activity implementation is surprisingly minimal once Gradle is properly configured.

The article reveals a non-standard Gradle trick (dependency verification mode) that's not in the official docs but essential for local builds.

About This Article

Problem

Signal's Android build needed Gradle 8.8 and minSdkVersion 24 for React Native compatibility. The original setup used Gradle 8.6 and minSdkVersion 21, so dependencies had to be carefully verified and adjusted.

Solution

Mariusz Stanisz added the org.gradle.dependency.verification=lenient flag and set up reactNativeArchitectures for armeabi-v7a, arm64-v8a, x86, and x86_64. This enabled local builds while keeping Hermes and New Architecture support intact.

Impact

The brownfield integration resulted in a working React Native implementation with just 13 lines of Kotlin boilerplate in ReactNativeActivity. New screens can now be built as standard React Native applications without needing extra native code.