var fs = require('fs'); var logger = require('console'); module.exports = function(context) { var Q = context.requireCordovaModule('q'); var deferral = new Q.defer(); var nameOld = 'platforms/android/build/outputs/apk/android-debug.apk'; var nameNew = 'platforms/android/build/outputs/apk/FFSpaLoaderExample.apk'; logger.log('rename-android-apk start old: %s',nameOld); fs.rename(nameOld,nameNew,function(err) { if (err) { return deferral.reject(err); } logger.log('rename-android-apk done new: %s',nameNew); deferral.resolve(); }); return deferral.promise; }