title: Add Custom values to build.gradle file via build-extras.gradle in Cordova
body: <p>I had updated cordova-android version to 6.4.0 and before that I had 5.1.1 installed. Here the problem was that when updated to 6.4.0 version, while building the project I was getting error. So to overcome that issue I had to add the below code</p>
  
  <pre><code>configurations.all {
          resolutionStrategy {
              force 'com.android.support:support-v4:27.1.0'
          }
  }
  </code></pre>
  
  <p>Now the problem is every time I build the project I have to edit build.gradle file, which is generated while adding the platform to the project in Cordova. As this is not part of Source Control.</p>
  
  <p>To overcome this I have used the solution from this <a href="https://gist.github.com/charlesbedrosian/8a33c866704ff51ab5700b272b7cf150" rel="nofollow noreferrer">post</a>. Here I am adding the Javascript file and adding the hook in the config.xml </p>
  
  <p>Java script file</p>
  
  <pre><code>var fs = require('fs');
  var rootdir = process.argv[2];
  
  var android_dir = rootdir + '/platforms/android';
  var gradle_file = rootdir + '/build-extras.gradle';
  var dest_gradle_file = android_dir + '/build-extras.gradle';
  
  if (fs.existsSync(android_dir) &amp;&amp; fs.existsSync(gradle_file)) {
      console.log('Copy ' + gradle_file + ' to ' + android_dir); 
      fs.createReadStream(gradle_file).pipe(fs.createWriteStream (dest_gradle_file));
  } else {
      console.log(gradle_file + ' not found. Skipping');
  }
  </code></pre>
  
  <p>Build-extras.gradle</p>
  
  <pre><code>ext.postBuildExtras = {
  android {
  configurations.all {
          resolutionStrategy {
              force 'com.android.support:support-v4:27.1.0'
           }
        }
     }
  }
  </code></pre>
  
  <p>Hooks in Config.xml</p>
  
  <pre><code>&lt;platform name="android"&gt;
      &lt;hook src="scripts/buildGradleHook.js" type="before_build" /&gt;
  &lt;/platform&gt;
  </code></pre>
  
  <p>The hooks added is not reflecting in the generated android folder. That is build-extras.gradle file is not reflected in android folder.</p>