Hi, there;
I am trying to build an Android production release which uses “environment.prod.ts”.
I have set up the filereplacement in angular.json:
I ran cmd: ionic build --prod successfully
Then I built a release in Android Studio: Build-->Generate Signed Bundle Apk.
But I still get a version that uses "environment.ts".
Can someone guide me what else step is missing here please?
Cheers,
Qiuwei
You need to also run:
ionic capacitor sync android --no-build
- Reference
Thanks twestrick.
ionic capacitor build android --prod also solves the issue.
Cheers,
Qiuwei
Yup, that works too! The only difference is that build
opens up Android Studio once the build is done. From my experience, both commands build a production build by default so --prod
is not required.
I did --no-build
because I missed the command you were running originally but now that I see you were doing ionic build
--no-build
is not required either. I use --no-build
if I want to build a JS dev build or something other than prod and use that in the native build (it tells the Ionic CLI to not rebuild the JS).
Cool. Thanks for the information, twestrick
Cheers,
Qiuwei