From d874b6d7926c40978656f3ea390db485fa21cf6d Mon Sep 17 00:00:00 2001 From: Edward Karuna Date: Thu, 11 Oct 2018 15:57:22 -0700 Subject: [PATCH] Copy bundled resources and js in Android App Bundle builds Android App Bundle builds use the packageBundle and bundle tasks instead of the package and assemble tasks the APK builds use. Because of this, the resources and js bundles weren't getting copied into the final artifact. In an App Bundle build, the merged assets must be present during the buildPreBundle step in order to arrive in the App Bundle. --- react.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/react.gradle b/react.gradle index bcc24b0c24cd18..34d99aa0cacdf1 100644 --- a/react.gradle +++ b/react.gradle @@ -97,6 +97,9 @@ afterEvaluate { ? variant.packageApplication : tasks.findByName("package${targetName}") + // pre bundle build task for Android plugin 3.2+ + def buildPreBundleTask = tasks.findByName("build${targetName}PreBundle") + def resourcesDirConfigValue = config."resourcesDir${targetName}" if (resourcesDirConfigValue) { def currentCopyResTask = tasks.create( @@ -114,6 +117,9 @@ afterEvaluate { } packageTask.dependsOn(currentCopyResTask) + if (buildPreBundleTask != null) { + buildPreBundleTask.dependsOn(currentCopyResTask) + } } def currentAssetsCopyTask = tasks.create( @@ -144,5 +150,8 @@ afterEvaluate { } packageTask.dependsOn(currentAssetsCopyTask) + if (buildPreBundleTask != null) { + buildPreBundleTask.dependsOn(currentAssetsCopyTask) + } } }