var fs = require('fs'); 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'; console.log('rename-android-apk start old: '+nameOld); fs.rename(nameOld,nameNew,function(err) { if (err) return deferral.reject(err); console.log('rename-android-apk done new: '+nameNew); deferral.resolve(); }); return deferral.promise; }