From fa854171798e67b8a10820f77d7198315e1784ed Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Thu, 3 Feb 2022 08:29:24 -0800 Subject: [PATCH] Do not bundle libhermes.so or libjsc.so inside the React Native Android AAR (#33038) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/33038 While rolling out RN 0.68.x we noticed that `libhermes.so` and `libjsc.so` were included inside the final .aar we publish to NPM. This forced users (on both old or new arch) to specify a `pickFirst` directive inside their packaging option (which is unpractical and risky as the two .so might not be compatible each other if they're coming from different Hermes/JSC versions). Changelog: [Android] [Fixed] - Do not bundle libhermes.so or libjsc.so inside the React Native Android AAR Reviewed By: ShikaSD Differential Revision: D33979107 fbshipit-source-id: 0b71d59f210b8bc9903cd0f30ed6e2120aab99e0 --- ReactAndroid/build.gradle | 6 ++++++ template/android/app/build.gradle | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 84821820cd2ff6..3e0f804219c135 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -351,6 +351,12 @@ android { packagingOptions { exclude("META-INF/NOTICE") exclude("META-INF/LICENSE") + // We intentionally don't want to bundle any JS Runtime inside the Android AAR + // we produce. The reason behind this is that we want to allow users to pick the + // JS engine by specifying a dependency on either `hermes-engine` or `android-jsc` + // that will include the necessary .so files to load. + exclude("**/libhermes.so") + exclude("**/libjsc.so") } configurations { diff --git a/template/android/app/build.gradle b/template/android/app/build.gradle index 850578b51d8ab4..506dca121113d4 100644 --- a/template/android/app/build.gradle +++ b/template/android/app/build.gradle @@ -233,11 +233,6 @@ android { } } - - packagingOptions { - pickFirst '**/libhermes.so' - pickFirst '**/libjsc.so' - } } dependencies {