From a4fed6e203efd481175e61b7d2aa1c2b037a4279 Mon Sep 17 00:00:00 2001 From: Edward Karuna Date: Tue, 2 Oct 2018 02:55:40 -0700 Subject: [PATCH] Add workaround for Android Gradle Plugin 3.2 change to asset dir (#21409) Summary: Android Gradle Plugin 3.2 uses a new intermediates/merged_assets directory instead of intermediates/assets. This workaround copies the javascript bundle to both directories for compatibility purposes. Fixes #21132 Fixes #18357 Pull Request resolved: https://github.com/facebook/react-native/pull/21409 Differential Revision: D10141860 Pulled By: hramos fbshipit-source-id: 0fb20fcec67ec2bfd7a8d9052599bbc70464b466 --- react.gradle | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/react.gradle b/react.gradle index d71b5c14d37..c1b22797ca0 100644 --- a/react.gradle +++ b/react.gradle @@ -117,9 +117,20 @@ afterEvaluate { group = "react" description = "copy bundled JS into ${targetName}." - from jsBundleDir - into file(config."jsBundleDir${targetName}" ?: - "$buildDir/intermediates/assets/${targetPath}") + if (config."jsBundleDir${targetName}") { + from jsBundleDir + into file(config."jsBundleDir${targetName}") + } else { + into ("$buildDir/intermediates") + into ("assets/${targetPath}") { + from jsBundleDir + } + + // Workaround for Android Gradle Plugin 3.2+ new asset directory + into ("merged_assets/${targetPath}/merge${targetName}Assets/out") { + from jsBundleDir + } + } // mergeAssets must run first, as it clears the intermediates directory dependsOn(variant.mergeAssets)