3

I'm developing a mobile app using Nativescript 6.5.x and Angular within a Debian VM. I have an emulator running on another machine.

Is there a way to tell the following command to run my code on my emulator on the remote machine

tns run android

Current work around is I mount my code directory on the remote machine and run the tns command over there. Problem with this work around is it breaks the 'Hot Module Replacement' so I have to reload the whole app everytime I change code.

Update

Seting up server & client using adb works

LTSPHOST (Server)

adb -a -P 5037 nodaemon server

LTSP (Client)

adb -H 192.168.200.7 -P 5037 devices

I can also see the devices through tns

ANDROID_ADB_SERVER_ADDRESS=192.168.200.7 tns device

Output

Connected devices & emulators
Searching for devices...
iTunes is not available for this operating system. You will not be able to work with connected iOS devices.
 ┌───┬───────────────────────────┬──────────┬───────────────────┬──────────┬───────────┬─────────────────┐
 │ # │ Device Name               │ Platform │ Device Identifier │ Type     │ Status    │ Connection Type │
 │ 1 │ Android SDK built for x86 │ Android  │ emulator-5586     │ Emulator │ Connected │ Local           │
 └───┴───────────────────────────┴──────────┴───────────────────┴──────────┴───────────┴─────────────────┘

Running 'tns run android' with the remote ADB server fails

ANDROID_ADB_SERVER_ADDRESS=192.168.200.7 ANDROID_ADB_SERVER_PORT=5037 tns run android --env.apiUrl='http://192.168.200.4:3000' --device emulator-5586

Output

Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (android)
Unable to apply changes on device: emulator-5586. Error is: connect ECONNREFUSED 127.0.0.1:38759.

Second time I ran produced a different port so I cannot simply ssh tunnel that one port.

Unable to apply changes on device: emulator-5586. Error is: connect ECONNREFUSED 127.0.0.1:33909.

Update: Check proxies

I have no proxies setup through npm or tns.

Update: Try latest nativescript

I install 7.0.11 and ran;

ANDROID_ADB_SERVER_ADDRESS=192.168.200.7 ANDROID_ADB_SERVER_PORT=5037 tns run android --env.apiUrl='http://192.168.200.4:3000' --device emulator-5586 --no-hmr

I got the same error

Unable to apply changes on device: emulator-5586. Error is: connect ECONNREFUSED 127.0.0.1:39679.
map7
  • 5,096
  • 6
  • 65
  • 128
  • 1
    See: [How can I deploy and execute an application on a device connected to a remote system?](https://stackoverflow.com/q/27245597/295004) and [NativeScript - Debugging the Android Runtime - adb forward](https://docs.nativescript.org/core-concepts/android-runtime/debug/debug-native#adb-forward). First step would be to get `adb` on your primary machine to connect to your emulator machine. That would depend on your local network configuration/firewalls. Once that is working the Nativescript command should use your existing `adb` connection, otherwise you'll have to the adb forward. – Morrison Chang Dec 08 '20 at 05:47

0 Answers0