Nativescript livesync broken?

Last year I’d created an app in Nativescript. Worked well, both Android and iOS versions. Even managed to get it into the Apple iTunes store (no mean feat in itself!).

So, this month it is time to update and change some things in the app. Small stuff but I took the occasion to update the various plugins and libraries at the same time. The old version was created with Nativescript 2.5, now Nativescript had moved on to V3.1.1. Some nice changes on the way, so worth the update.

There are a few breaking changes (helpfully listed here) but on the whole not too painful at all. Except, after getting it all working I noticed that the app was no longer refreshing when files were changed (this is while developing). According to the console, modified files were being pushed up successfully but nothing was changing on the app. I spent literally a whole day trying to work this out and here is the solution. I hope it helps someone else.

In the package.json file, there is a line:

"nativescript":{
"id":"com.everyapp.en99app",

This id now needs to appear in the app/App_Resources/Android/app.gradle build file like so:

android {
    defaultConfig {
        generatedDensities = []
        applicationId = "com.everyapp.en99app"
    }
    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
}

Earlier versions of Nativescript didn’t provide the app.gradle “applicationId” key and clearly didn’t check that when uploading the files to the emulator.