2

I follow The NativeScript Book by Brosteins. I cannot find how to connect my android device.

Steps made are:

tns --version; returns 4.2.2
tns create Hello World
cd Hello World
tns platform add android

Next I connect android Moto g6 (android 8.0.0) with usb cable to windows 10 computer on which I run NativeScript. Next I use tns devices to check for a connection.

>tns devices gives:

Connected devices & emulators Searching for devices... iTunes is not installed. Install it on your system and run this command again. Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.

On my android phone I I find " Android-device loading through USB. When clicking I can change this in "transferring files" , "transferring pictures (PTP)" or use device as MIDI. I have tried them all, getting the above message that no android device is visible.

On Windows 10 I see that an Android audio device is connected. I find no other options to connect to Android phone.

Questions:

  1. How can I connect my android device to windows 10 computer by usb cable and make it seen by tns devices ?

  2. Why am I asked to install itunes (see above) while I am working with android (see above, tns platform add android)?

pfx
  • 20,323
  • 43
  • 37
  • 57
Jokro
  • 21
  • 5
  • 1
    Did you enabled developer mode in device ? – Marek Maszay Aug 27 '18 at 12:31
  • I solved the question.
    The android phone setting should be
    – Jokro Aug 28 '18 at 13:42
  • Thx Marek for this answer which is not clearly mentioned in the textbook nor in Gettingstarted. With your help I got the right keyword for googling the solution: The android phone must be set to developer mode. This is a hidden option. Go to Settings/System/About/Build nr and click 7 times on the nr to enable developer settings. Next you can find a new menu at Settings/System/Developer options. In this menu allow USB-debugging. You may also set " Stay active" to prevent the phone to go to sleep while debugging. It would be usefull to add this instruction to Gettingstarted... – Jokro Aug 28 '18 at 13:56

1 Answers1

3

You probably need to enable developer mode on the device.

Here's a tutorial that shows how to do it:

1.Open the Settings app.

2.Select About phone

3.Scroll to the bottom and tap Build number 7 times.

4.Return to the previous screen to find Developer options near the bottom

5.Click developer options and check the box for Enable USB Debugging

6.If you're plugged into your development computer via USB, a popup will ask whether to trust the computer or not -- select to trust your development computer.

Now try running tns device android and you should see your device listed. Then running tns run android should run your app on your device.

Steven Pfeifer
  • 345
  • 4
  • 11