How to create a apk with different environments?

Hi Developers,

I have created an in browser application for which I have provided different environments (eg., test, production, demo) and when I am creating an apk it is building for only one environment. I have set my configurations also in angular.json.
Can someone help me how to create different builds and then create apk containing all these builds in it, so when user tries to login it has to connect to that environment.

Note: I am using Cordova for this

ionic build --configuration=< environment >

ie the file name in the environments folder is environment.test.ts then it would be:

ionic build --configuration=test

this builds the app using the configuration set in that environment. You then:

ionic cap sync
ionic cap open andoid

and then build you apk for that build