diff --git a/react.gradle b/react.gradle index b9187afba414aa..ecc990772b44e3 100644 --- a/react.gradle +++ b/react.gradle @@ -17,7 +17,9 @@ def bundleConfig = config.bundleConfig ? "${reactRoot}/${config.bundleConfig}" : afterEvaluate { - android.applicationVariants.all { def variant -> + def isAndroidLibrary = plugins.hasPlugin("com.android.library") + def variants = isAndroidLibrary ? android.libraryVariants : android.applicationVariants + variants.all { def variant -> // Create variant and target names def targetName = variant.name.capitalize() def targetPath = variant.dirName @@ -96,6 +98,9 @@ afterEvaluate { def packageTask = variant.hasProperty("packageApplication") ? variant.packageApplication : tasks.findByName("package${targetName}") + if (variant.hasProperty("packageLibrary")) { + packageTask = variant.packageLibrary + } def resourcesDirConfigValue = config."resourcesDir${targetName}" if (resourcesDirConfigValue) {