Change name of android build binary

When i build a binary using ionic build android, the output binary is created in a specific folder - platforms\android\build\outputs\apk

Can i change the default name of the binary - it always gets created as android-debug.apk - this using a CLI command?

I don’t know of any command, cordova build (which is wrapped by ionic build) only has these options:

> cordova build --help
Synopsis

cordova build [PROD] [TARGET] [EXP] [PLATS] [BUILDCONFIG] [-- POPTS]

  PROD:   --debug|--release
  TARGET: --device|--emulator|--target=FOO
  EXP:    --experimental [EXPERIMENTALFLAGS]
  PLATS:  PLATFORM [...]
  BUILDCONFIG: --buildConfig=CONFIGFILE
  POPTS:  platformopts

Shortcut for `cordova prepare` + `cordova compile` for
all/the specified platforms.

--debug ............................ debug build
--release .......................... release build

--device ........................... Deploy to a device
--emulator ......................... Deploy to an emulator
--target ........................... Deploy to a specific target

--buildConfig....................... Use the specified build configuration
                                     instead of default build.json

To provide platform specific options, you must include them after `--`.

Experimental Flags

--browserify ....................... Plugins javascript gets loaded at build time instead of runtime using browserify.
                                     Replaces cordovajs file with one that includes the JS of the installed plugins.


Example

cordova build android --release --buildConfig=..\myBuildConfig.json`

Maybe the --buildConfig can take care of this.

But why do you want to do that?

Hi,

Firstly thanks for the response.

I am trying to build an automated script that automatically creates a binary with specified filename. However, now i have updated the script to copy the file in a separate location and then rename the file.

Thanks for this. :smile:

Care to share for others to learn and maybe use it?

2 Likes