Nativescript: CLI does not sync with android when I make changes

Created on 8 Mar 2017  路  11Comments  路  Source: NativeScript/NativeScript

When I run tns run android, the project gets built and deployed on my emulator (I am using genymotion). The app is not launched though, I need to launch via clicking the icon in the emulator. Then, changes I make to my project are not synced to the emulator. See this video:
https://www.youtube.com/watch?v=wzEmtD-oPDo&feature=youtu.be

If I terminate the process and run tns run android again, I get this message:
Skipping package build. No changes detected on the native side. This will be fast!
Even though there are indeed changes.

The only way to see the changes on the emulator is to either remove android platform, add it back and do tns run, or running this command: tns run android --clean, which I believe removes the platform and adds it back.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.5.2
  • Cross-platform modules: 2.5.1
  • Runtime(s): 2.5.0
  • Plugin(s):
    "moment": "^2.15.2",
    "nativescript-background-http": "^2.4.2",
    "nativescript-grid-view": "^1.4.0",
    "nativescript-imagecropper": "0.0.7",
    "nativescript-iqkeyboardmanager": "^1.0.1",
    "nativescript-onesignal": "^1.0.5",
    "nativescript-orientation": "^1.5.4",
    "nativescript-photoviewer": "^1.0.0",
    "nativescript-pulltorefresh": "^1.1.10",
    "nativescript-purchase": "^1.0.1",
    "nativescript-slides": "^2.2.4",
    "nativescript-telerik-ui": "^1.4.1",
    "nativescript-web-image-cache": "^3.4.0",
    "tns-core-modules": "^2.5.1"
android question

Most helpful comment

Please make sure that package.json id is the same as applicationId setting on app/App_Resources/Android/app.gradle

All 11 comments

Hi @davecoffin,
Could verify, whether you will have the same behavior while using default Android emulator?
You could review the article here, where has been described, how to setup Android Emulators.

Regards,
@tsonevn

@tsonevn The same issue exists using the traditional Android emulator.

Please make sure that package.json id is the same as applicationId setting on app/App_Resources/Android/app.gradle

@ignaciofuentes That fixed it! Thank you so much!! I will close this issue.

I have the same issue. I checked the application id in both files and it is as is has to be. I also tried to change de tns-android version, from 3.0.0 to 2.5.0 and nothing. Any idea why is this happening?

Hi @locolauty97,
Could you provide more info about your environment (CLI, tns-core-modules version)? It would also help if you could provide sample project, which could be debugged locally.

Meanwhile, try to delete the application from the device, delete the platforms and node_modules folders from the project and rebuild again with tns run android

this is a portion of my package.json file. (I erased the id property)

"nativescript": {
    "id": "-",
    "tns-android": {
      "version": "3.0.0"
    }
  },
  "dependencies": {
    "nativescript-cardview": "^1.3.2",
    "nativescript-drop-down": "^1.5.3",
    "nativescript-statusbar": "^1.0.0",
    "nativescript-theme-core": "~1.0.2",
    "tns-core-modules": "^3.0.0",
    "tns-core-modules-snapshot": "2.5.0-5.5.372.32"
  },
  "devDependencies": {
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "lazy": "1.0.11",
    "nativescript-dev-android-snapshot": "^0.*.*"
  }

My tns cli version is 3.0.0

Hi @locolauty97,
There was an issue with the live sync with NativeScript 3.0.0, regarding that, we published new CLI version, where this should be fixed.
You could upgrade to CLI 3.0.1 by using npm install nativescript --g.
Before rebuilding makes sure to remove the app from the device or emulator and delete platforms and node_modules folders from the project.

I upgraded the CLI to 3.0.1, but when I run the project and I make a change, the livesync doesn't work and shows this error:
Unable to sync files. Error is: Multiple errors were thrown: ENOENT: no such file or directory, stat '/home/lautaro/proyectos/nativescript/test/platforms/android/src/main/assets/app/main-page.xml___jb_tmp___'

I just created that project to test the CLI, so I think there is not a problem with dependencies or so.
I am working on ubuntu.
Thanks

Hi @locolauty97
I found that similar error has been reported here in this thread in nativescript-cli repository. Regarding that, you could review the given workaround in this comment, which should fix this problem with the livesync for now.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lscown picture lscown  路  163Comments

tjvantoll picture tjvantoll  路  46Comments

rclai picture rclai  路  52Comments

lscown picture lscown  路  58Comments

morningrat picture morningrat  路  67Comments