From 68188b417b2ce807365a6438f9b342977591d78b Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Tue, 25 Jun 2024 14:54:08 +0200 Subject: [PATCH] Add dependency on task building hermes --- android/app/build.gradle | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index bb0b8652ad21..57b2f60849a6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -190,6 +190,23 @@ android { } } +afterEvaluate { + // As the App is building from source, we need to make sure hermesc is built before the JS bundle is created. + // Otherwise the release version of the app will fail to build due to missing hermesc. + def hermesCTask = gradle.includedBuild("react-native").task(":packages:react-native:ReactAndroid:hermes-engine:buildHermesC") + + android.applicationVariants.configureEach { variant -> + if (variant.buildType.name == "release") { + def variantName = variant.name.capitalize() + def bundleTask = tasks.named("createBundle${variantName}JsAndAssets").getOrNull() + + if (bundleTask != null) { + bundleTask.dependsOn(hermesCTask) + } + } + } +} + dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android")