diff --git a/android/codepush.gradle b/android/codepush.gradle index 60d8144..dd4adc6 100644 --- a/android/codepush.gradle +++ b/android/codepush.gradle @@ -40,6 +40,14 @@ gradle.projectsEvaluated { def resourcesDirConfigName = "jsBundleDir${targetName}" def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?: file("$buildDir/intermediates/res/merged/${targetPath}") + + // In case version of 'Android Plugin for Gradle'' is lower than 1.3.0 + // '$buildDir' has slightly different structure - 'merged' folder + // does not exists so '${targetPath}' folder contains directly in 'res' folder. + if (!resourcesDir.exists() && file("$buildDir/intermediates/res/${targetPath}").exists()) { + resourcesDir = file("$buildDir/intermediates/res/${targetPath}") + } + def jsBundleFile = file("$jsBundleDir/$bundleAssetName") // Make this task run right before the bundle task diff --git a/scripts/recordFilesBeforeBundleCommand.js b/scripts/recordFilesBeforeBundleCommand.js index bc5e03d..d2deaf5 100644 --- a/scripts/recordFilesBeforeBundleCommand.js +++ b/scripts/recordFilesBeforeBundleCommand.js @@ -16,7 +16,15 @@ var TEMP_FILE_PATH = path.join(require("os").tmpdir(), "CodePushResourcesMap.jso var resourcesDir = process.argv[2]; var resourceFiles = []; -getFilesInFolder(resourcesDir, resourceFiles); +try { + getFilesInFolder(resourcesDir, resourceFiles); +} catch(error) { + var targetPathNotFoundExceptionMessage = "\nResources directory path does not exist.\n"; + targetPathNotFoundExceptionMessage += "Unable to find '" + resourcesDir; + targetPathNotFoundExceptionMessage += "' directory. Please check version of Android Plugin for Gradle."; + error.message += targetPathNotFoundExceptionMessage; + throw error; +} var fileToModifiedTimeMap = {};