[Solved] Cordova hot code push not working

I’m developing a cordova app and hot code push is not working to an android build I created that I installed from APK. It is a signed release apk sideloaded to an android phone (not through the play store)

Here was my code to build the apk:

meteor build ../build/ --server=https://example.com --mobile-settings settings-production.json

I am using Gitlab’s CI/CD to automatically deploy to Digital Ocean whenever I commit to deploy branch. Here is the build command in my runner:

meteor build /home/gitlab-runner/build-output --server=https://example.com --server-only

I’m not sure where to start checking. Needs some assistance here.

I forgot to add that I’m using Meteor 1.6.1

I thought hot code push only work in dev and not on compiled APKs.

Perhaps you can take a look here as a starting point.

HCP works in production cordova builds for Android and iOS. It was working last week and I’m trying to figure out why it stopped

I think it works for build files because you’ve a Gitlab’s CI configured and you are constantly deploying. Why you want HOC enabled in production? I think what they’re saying here is that the same HOC capability can be used to updated clients code without having them download the APK again.

Are you pointing to a local dev server or a remote production server?

My Gitlab CI/CD scripts are just automating steps that I would do if I deploy manually. So I’m not sure how HCP will work just because of CI/CD.

It is a remote staging server (mirror of production).

Sorry my bad I understand now, I got mixed up for a moment with Hot Module Replacement (HMR) :sweat_smile:

So basically you’re saying when the updates are pushed the client mobile devices are not refreshing automatically to pick up the changes, is that correct?

Yep. Hot code push stopped working.

I was wrong earlier. I am using So it stopped working when I updated to from 1.6.1

I’m clearing caches now and doing a manual install to verify if it was the automated deployment but I haven’t changed it for weeks now.

1 Like

Ok. So I found the culprit now. It was a mismatch of Meteor version.

My machine that created the APk build at Meteor
Gitlab-runner machine creating the server build at Meteor 1.6.1

I learned something new with this CI/CD thing. Now I need to remember to add meteor update in the build script whenever I updated meteor. I also removed caching in my CI build script just to be safe (longer build of just 1 minute)

1 Like

Good catch! glad you found it.

So due to server version mismatch between the server and the published APK after a Meteor update, the hot code push was not being triggered at the client. Good to know…

What we do is use the Cordova env variables at each compile to make sure all clients get updated - but make sure you test on your clients in case the meteor Cordova stack makes breaking changes

Can you help explain how did you do it to minimize the issues of mismatch Meteor versions like I posted above?