diff --git a/local-cli/generator-android/templates/src/app/build.gradle b/local-cli/generator-android/templates/src/app/build.gradle index 05682ee30..ee7028cf4 100644 --- a/local-cli/generator-android/templates/src/app/build.gradle +++ b/local-cli/generator-android/templates/src/app/build.gradle @@ -26,7 +26,9 @@ import com.android.build.OutputFile * * // whether to bundle JS and assets in another build variant (if configured). * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property is in the format 'bundleIn${productFlavor}${buildType}' + * // The configuration property can be in the following formats + * // 'bundleIn${productFlavor}${buildType}' + * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, diff --git a/local-cli/generator-android/templates/src/app/react.gradle b/local-cli/generator-android/templates/src/app/react.gradle index 4b43bf910..11a4f8b87 100644 --- a/local-cli/generator-android/templates/src/app/react.gradle +++ b/local-cli/generator-android/templates/src/app/react.gradle @@ -30,21 +30,20 @@ gradle.projectsEvaluated { productFlavors.each { productFlavorName -> buildTypes.each { buildTypeName -> - // Create variant and source names - def sourceName = "${buildTypeName}" - def targetName = "${sourceName.capitalize()}" - if (productFlavorName) { - sourceName = "${productFlavorName}${targetName}" - } + // Create variant and target names + def targetName = "${productFlavorName.capitalize()}${buildTypeName.capitalize()}" + def targetPath = productFlavorName ? + "${productFlavorName}/${buildTypeName}" : + "${buildTypeName}" // React js bundle directories def jsBundleDirConfigName = "jsBundleDir${targetName}" def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?: - file("$buildDir/intermediates/assets/${sourceName}") + file("$buildDir/intermediates/assets/${targetPath}") def resourcesDirConfigName = "jsBundleDir${targetName}" def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: - file("$buildDir/intermediates/res/merged/${sourceName}") + file("$buildDir/intermediates/res/merged/${targetPath}") def jsBundleFile = file("$jsBundleDir/$bundleAssetName") // Bundle task name for variant @@ -80,7 +79,9 @@ gradle.projectsEvaluated { "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir } - enabled config."bundleIn${targetName}" ?: targetName.toLowerCase().contains("release") + enabled config."bundleIn${targetName}" || + config."bundleIn${buildTypeName.capitalize()}" ?: + targetName.toLowerCase().contains("release") } // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process