diff --git a/scripts/lib/android-helper.js b/scripts/lib/android-helper.js index a7e2e3a8f..87006f573 100644 --- a/scripts/lib/android-helper.js +++ b/scripts/lib/android-helper.js @@ -21,18 +21,18 @@ function addDependencies(buildGradle) { // find the known line to match var match = buildGradle.match(/^(\s*)classpath 'com.android.tools.build(.*)/m); var whitespace = match[1]; - + // modify the line to add the necessary dependencies var googlePlayDependency = whitespace + 'classpath \'com.google.gms:google-services:4.1.0\' // google-services dependency from cordova-plugin-firebase'; var fabricDependency = whitespace + 'classpath \'io.fabric.tools:gradle:1.25.4\' // fabric dependency from cordova-plugin-firebase' var modifiedLine = match[0] + '\n' + googlePlayDependency + '\n' + fabricDependency; - + // modify the actual line return buildGradle.replace(/^(\s*)classpath 'com.android.tools.build(.*)/m, modifiedLine); } /* - * Add Crashlytics repos to the repository list + * Add 'google()' to the repository repo list */ function addRepos(buildGradle) { // find the known line to match @@ -40,8 +40,9 @@ function addRepos(buildGradle) { var whitespace = match[1]; // modify the line to add the necessary repo + var googlesMavenRepo = whitespace + 'google() // Google\'s Maven repository from cordova-plugin-firebase'; var fabricMavenRepo = whitespace + 'maven { url \'https://maven.fabric.io/public\' } // Fabrics Maven repository from cordova-plugin-firebase' - var modifiedLine = match[0] + '\n' + fabricMavenRepo; + var modifiedLine = match[0] + '\n' + googlesMavenRepo + '\n' + fabricMavenRepo; // modify the actual line return buildGradle.replace(/^(\s*)jcenter\(\)/m, modifiedLine); @@ -67,7 +68,7 @@ module.exports = { // Add Google Play Services Dependency buildGradle = addDependencies(buildGradle); - + // Add Google's Maven Repo buildGradle = addRepos(buildGradle); @@ -84,7 +85,7 @@ module.exports = { // remove any lines we added buildGradle = buildGradle.replace(/(?:^|\r?\n)(.*)cordova-plugin-firebase*?(?=$|\r?\n)/g, ''); - + writeRootBuildGradle(buildGradle); } -}; +}; \ No newline at end of file