rodrigograca31
7/29/2016 - 1:08 PM

Cordova hook that displays the .apk size and opens the folder containing it.

Cordova hook that displays the .apk size and opens the folder containing it.

#!/usr/bin/env node

// make sure android platform is part of build
//    if (ctx.opts.platforms.indexOf('android') < 0) {
//        return;
//    }

var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;

//var apkFileLocation = path.resolve(__dirname, '../../platforms/android/build/outputs/apk/android-release.apk');

fs.stat('./platforms/android/build/outputs/apk/android-release.apk', function(err,stats) {
    if (err) {
        console.log('\nAn error has occurred\n');
    } else {
        console.log('\nSize of "android-release.apk" is ' + ((stats.size/1024)/1024).toFixed(2) + 'M\n');
    }
});

// It should detect the file explorer....
exec('nemo ./platforms/android/build/outputs/apk/', function(error, stdout, stderr) {});
#!/usr/bin/env node

// make sure android platform is part of build
//    if (ctx.opts.platforms.indexOf('android') < 0) {
//        return;
//    }

var fs = require('fs');
var path = require('path');
var exec = require('child_process').exec;

//var apkFileLocation = path.resolve(__dirname, '../../platforms/android/build/outputs/apk/android-release.apk');

fs.stat('./platforms/android/build/outputs/apk/android-debug.apk', function(err,stats) {
    if (err) {
        console.log('\nAn error has occurred\n');
    } else {
        console.log('\nSize of "android-debug.apk" is ' + ((stats.size/1024)/1024).toFixed(2) + 'M\n');
    }
});