Skip to content

Instantly share code, notes, and snippets.

Last active March 19, 2020 11:01
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Copy build-extras to platforms/android
#!/usr/bin/env node
//goes in hooks/after_platform_add/
var fs = require('fs');
rootdir = process.argv[2],
android_dir = rootdir + '/platforms/android';
gradle_file = rootdir + '/build-extras.gradle';
dest_gradle_file = android_dir + '/build-extras.gradle';
if (fs.existsSync(android_dir) && fs.existsSync(gradle_file)) {
console.log('Copy ' + gradle_file + ' to ' + android_dir);
} else {
console.log(gradle_file + ' not found. Skipping');
Copy link

GBoll commented Mar 9, 2018

Hi, where does this .js file go? I use cordova cli. My only plugin is Crosswalk, which doesn't even have anything like anywhere.

Copy link

Bessonov commented Mar 9, 2018

@charlesbedrosian thank you!

@GBoll as comment states:

goes in hooks/after_platform_add/

You must set it executable.

Copy link

dilhan2013 commented Mar 23, 2018

I had to copy to /platforms/android/app

Copy link

Hi Charles,

I wanted to know how add the build-extras.gradle code to build.gradle file. Because I am facing an issue when I am trying to add the build-extras.gradle file data to build.gradle file.

Below is the error which I am facing

1: Invalid variable name. Must start with a letter but was: ?ext . At [1:1] @ line 1, column 1. ?ext.postBuildExtras = { ^

And this is my build-extras.gradle code

ext.postBuildExtras = { android { configurations.all { resolutionStrategy { force '' } } } }


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment