Create, build and deploy extremely slow


#1

Hi everybody,

Creating a new project takes 8-10 minutes. The first prepare, build and deploy may take up to 25-30 minutes. Even when the app is already running, a refresh and restart takes 3-6 minutes. I am spending the best of my time with merely waiting for the changes to appear.

It’s NOT the emulator, because I am using a real device. (Got to emphasize it because I already got a lot of answers on how to speed up my emulator… no, there is NO emulator!)

It’s also not the complexity of the project because it’s a blank Hello World project.

It doesn’t matter whether the project is JavaScript, TypeScript or Angular. It’s the same.

I tried turning off the antivirus. It’s also not my Internet connection speed. I am using an USB cable.

Here are some parameters:

tns version: 3.3.1
Java JRE version: 1.8.0
OS: Windows 7 Home 64-bit
CPU: Intel B940, 2 GHz
RAM: 8 GB
Phone: Samsung J-120W
Android version: 6.0.1, stock ROM

I just measured how long it takes to run a fresh, new project.

tns prepare android took 15:03 minutes after tns-android was installed. Granted, it has to install some stuff, but this still seems a bit excessive.

After preparation, tns build android took 16:18 minutes.

tns deploy android took another 03:55 minutes.

All together this was 34 minutes and 16 seconds, which is really terrible.

After that I tried tns run android and it took another 5 minutes to finish.

When I change the code, tns does a full rebuild and restarts the app on the device. Probably that’s the problem, but how to prevent this? I don’t have hours to fix a simple CSS misalignment just because the compiler goes throught the entire app every time I press a key.


#2

When I hear create project, I think you are talking about tns create projectName. But I believe here you are talking about the first initial install and deployment of the app on your device/emulator?

I understand your problem is discussing the device, but is it the same result on an emulator? Trying to eliminate the variables here.

Your process for running a new project should be:

tns create myProject
cd myProject
npm i
tns run android

for building based off that:

tns build android

I do not understand why you keep running tns prepare if you aren’t trying to sync up assets from App_Resources to the platforms directory. That command very clearly states on the CLI documentation that it re-creates all the platform data.

NativeScript does not offer true “live reload” or “hot module replacement” at this time. So yes, it is rebuilding your source code (just the file changed) and then re-bootstrapping your app. It’s not doing a full re-build of all the contents of your app. If it is, look at the terminal for the files and changed and see if anything seems off here.

when the app is already running, a refresh and restart takes 3-6 minutes

I take it you are also referring to the device here and not the emulator. For development it’s not really recommended to use a device over the emulator. The device has to re-install the full apk plus run all of the underlying Android build.

What version of Node.JS are you running?


#3

Oh, I see. So the lightning fast, instant update which I saw in tutorial videos only happen in the emulator, and not on a real device? That may be the problem then.

My Node.js is 6.11.5 by the way.