Skip to content

Emulator device showing unreachable #3314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kamlekar opened this issue Jan 10, 2018 · 13 comments
Closed

Emulator device showing unreachable #3314

kamlekar opened this issue Jan 10, 2018 · 13 comments

Comments

@kamlekar
Copy link

Similar to this issue.

Tell us about the problem

Device showing as unreachable

image

image

Which platform(s) does your issue occur on?

Both

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

  • CLI: 3.4.0

  • Runtime(s):

        "tns-ios": {
          "version": "3.4.0"
        },
        "tns-android": {
          "version": "3.2.0"
        }
    
  • Plugin(s):

        "dependencies": {
           "install": "^0.10.2",
          "nativescript-background-http": "^3.1.0",
          "nativescript-barcodescanner": "^2.7.1",
          "nativescript-carousel": "^3.1.1",
          "nativescript-imagepicker": "^4.0.1",
          "nativescript-na-camera": "https://github.com/kamlekar/nativescript-na-camera/tarball/master",
          "nativescript-theme-core": "~1.0.2",
          "tns-core-modules": "~3.2.0"
        },
        "devDependencies": {
          "babel-traverse": "6.4.5",
          "babel-types": "6.4.5",
          "babylon": "6.4.5",
          "lazy": "1.0.11"
        }
    
@Plamen5kov
Copy link
Contributor

Hi @kamlekar, can you answer a couple of questions so we can help you figure out your problem:

  • Are you, by any chance, trying to connect to your device through wi-fi instead of a usb cable?
  • Are you on a virtual machine? (possible network problem)
  • Are you running geny motion emulator or a regular image coming from the android tooling? (adb.exe sometimes fights with other android sdk installed on your machine)
  • Do you have Android Studio installed? Where does your ANDROID_HOME variable point to echo %ANDROID_HOME%? (maybe the path is too long and windows is struggling with it)

@kamlekar
Copy link
Author

kamlekar commented Jan 10, 2018

Hi @Plamen5kov, last time when I checked, it used to work when I used to run cmd as adminstrator. It is my Home PC, and I check it rare.

  • Are you, by any chance, trying to connect to your device through wi-fi instead of a usb cable?

I am trying to connect Emulator (which I installed through Android Studio)

  • Are you on a virtual machine? (possible network problem)

No, I am on Windows 10 (and I am on high speed network)

  • Are you running geny motion emulator or a regular image coming from the android tooling? (adb.exe sometimes fights with other android sdk installed on your machine)

I have no idea, but I am sure I am not running any other emulator.

  • Do you have Android Studio installed? Where does your ANDROID_HOME variable point to echo %ANDROID_HOME%? (maybe the path is too long and windows is struggling with it)

It is in {user}/AppData/Local/Android/Sdk. Please check below environmental variables screenshot.

image

@Plamen5kov
Copy link
Contributor

Can you enter {user}/AppData/Local/Android/Sdk/platform-tools, open a terminal there, run adb devices command and post the result here?

@kamlekar
Copy link
Author

Here is the screenshot:

image

Also, I forgot to tell you that in Android studio, I am unable to find Android menu inside Tools, which was visible before.

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Jan 10, 2018

This is often caused by a plugin that's not working could you post a screenshot with File/Settings -> Plugins. You can also try this where people have the same issue as you do.
The missing android option inside tools menu is an indicator of a missing tools folder inside %ANDROID_HOME% directory. Can you please make sure that's the case?

@kamlekar
Copy link
Author

@Plamen5kov Here are the screenshots:

image

image

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Jan 10, 2018 via email

@kamlekar
Copy link
Author

@Plamen5kov nope. Still not there.

@kamlekar
Copy link
Author

@Plamen5kov I switched the project to the first project which was created when Android studio was installed. And now after sometime, I was able to see Tools => Android :/

I changed the default project once, thinking I can work this nativescript project through Android Studio instead of VS Code.

And then when I checked adb devices as you mentioned above, I was able the see offline devices.

image

@Plamen5kov
Copy link
Contributor

Plamen5kov commented Jan 11, 2018

@kamlekar one thing you can do is restart the adb server by running adb kill-server && adb start-server and try running the emulators and making sure they are online by doing as you have adb devices.

I changed the default project once, thinking I can work this nativescript project through Android Studio instead of VS Code.

In the latest release 3.4.0 of the tns-android platform you actually can open your project in Android Studio. Just open this folder <app_name>/platforms/android with android studio once you have prepared the project, by running tns prepare android.

@kamlekar
Copy link
Author

Hi @Plamen5kov,

I tried as you said. It is still showing as offline:

image

Here is the log trace of when I run tns run android --log trace > log.txt.

Loading extensions.
execFile: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "help"
Exec npm -v
stdout: 5.5.1

stderr:
spawn: java "-version"
Exec node-gyp -v
stdout:
stderr: 'node-gyp' is not recognized as an internal or external command,
operable program or batch file.

Error while executing node-gyp -v: Command failed: node-gyp -v
'node-gyp' is not recognized as an internal or external command,
operable program or batch file.

Exec "C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb" version
stdout: Android Debug Bridge version 1.0.39
Version 0.0.1-4500957
Installed as C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe

stderr:
spawn: C:\Users\User\AppData\Local\Android\Sdk\emulator\emulator "-help"
Result when throw error is false:
{ stdout: 'Android Emulator usage: emulator [options] [-qemu args]\r\n options:\r\n -list-avds list available AVDs\r\n -sysdir

search for system disk images in \r\n -system read initial system image from \r\n -vendor read initial vendor image from \r\n -writable-system make system & vendor image writable after 'adb remount'\r\n -datadir write user data into \r\n -kernel use specific emulated kernel\r\n -ramdisk ramdisk image (default /ramdisk.img\r\n -image obsolete, use -system instead\r\n -initdata same as '-init-data '\r\n -data data image (default /userdata-qemu.img\r\n -encryption-key read initial encryption key image from \r\n -logcat-output output file of logcat(default none)\r\n -partition-size system/data partition size in MBs\r\n -cache cache partition image (default is temporary file)\r\n -cache-size cache partition size in MBs\r\n -no-cache disable the cache partition\r\n -nocache same as -no-cache\r\n -sdcard SD card image (default /sdcard.img\r\n -snapstorage file that contains all state snapshots (default /snapshots.img)\r\n -no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)\r\n -snapshot name of snapshot within storage file for auto-start and auto-save (default 'default-boot')\r\n -no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage\r\n -no-snapshot-save do not auto-save to snapshot on exit: abandon changed state\r\n -no-snapshot-load do not auto-start from snapshot: perform a full boot\r\n -snapshot-list show a list of available snapshots\r\n -no-snapshot-update-time do not try to correct snapshot time on restore\r\n -wipe-data reset the user data image (copy it from initdata)\r\n -avd use a specific android virtual device\r\n -skindir search skins in (default /skins)\r\n -skin select a given skin\r\n -no-skin deprecated: create an AVD with no skin instead\r\n -noskin same as -no-skin\r\n -memory physical RAM size in MBs\r\n -cores Set number of CPU cores to emulator\r\n -accel Configure emulation acceleration\r\n -no-accel Same as '-accel off'\r\n -ranchu Use new emulator backend instead of the classic one\r\n -engine Select engine. auto|classic|qemu2\r\n -netspeed maximum network download/upload speeds\r\n -netdelay network latency emulation\r\n -netfast disable network shaping\r\n -code-profile enable code profiling\r\n -show-kernel display kernel messages\r\n -shell enable root shell on current terminal\r\n -no-jni disable JNI checks in the Dalvik runtime\r\n -nojni same as -no-jni\r\n -logcat enable logcat output with given tags\r\n -no-audio disable audio support\r\n -noaudio same as -no-audio\r\n -audio use specific audio backend\r\n -radio redirect radio modem interface to character device\r\n -port TCP port that will be used for the console\r\n -ports , TCP ports used for the console and adb bridge\r\n -onion use overlay PNG image over screen\r\n -onion-alpha <%age> specify onion-skin translucency\r\n -onion-rotation 0|1|2|3 specify onion-skin rotation\r\n -dpi-device specify device's resolution in dpi (default 165)\r\n -scale scale emulator window (deprecated)\r\n -http-proxy make TCP connections through a HTTP/HTTPS proxy\r\n -timezone use this timezone instead of the host's default\r\n -dns-server use this DNS server(s) in the emulated system\r\n -net-tap use this TAP interface for networking\r\n -net-tap-script-up <script> script to run when the TAP interface goes up\r\n -net-tap-script-down <script> script to run when the TAP interface goes down\r\n -cpu-delay throttle CPU emulation\r\n -no-boot-anim disable animation for faster boot\r\n -no-window disable graphical window display\r\n -no-sim device has no SIM card\r\n -lowram device is a low ram device\r\n -version display emulator version number\r\n -report-console report console port to remote socket\r\n -gps redirect NMEA GPS to character device\r\n -shell-serial specific character device for root shell\r\n -tcpdump capture network packets to file\r\n -bootchart enable bootcharting\r\n -charmap use specific key character map\r\n -studio-params used by Android Studio to provide parameters\r\n -prop = set system property on boot\r\n -shared-net-id join the shared network, using IP address 10.1.2.\r\n -gpu set hardware OpenGLES emulation mode\r\n -camera-back set emulation mode for a camera facing back\r\n -camera-front set emulation mode for a camera facing front\r\n -webcam-list lists web cameras available for emulation\r\n -screen set emulated screen mode\r\n -force-32bit always use 32-bit emulator\r\n -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode\r\n -unix-pipe Add to the list of allowed Unix pipes\r\n -fixed-scale Use fixed 1:1 scale for the initial emulator window.\r\n -wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming\r\n -skip-adb-auth Skip adb authentication dialogue\r\n -metrics-to-console Enable usage metrics and print the messages to stdout\r\n -metrics-to-file Enable usage metrics and write the messages into specified file\r\n -feature <name|-name> Force-enable or disable (-name) the features\r\n -sim-access-rules-file Use SIM access rules from specified file\r\n\r\n -qemu args... pass arguments to qemu\r\n -qemu -h display qemu help\r\n\r\n -verbose same as '-debug-init'\r\n -debug enable/disable debug messages\r\n -debug- enable specific debug messages\r\n -debug-no- disable specific debug messages\r\n\r\n -help print this help\r\n -help- print option-specific help\r\n\r\n -help-disk-images about disk images\r\n -help-debug-tags debug tags for -debug \r\n -help-char-devices character specification\r\n -help-environment environment variables\r\n -help-virtual-device virtual device management\r\n -help-sdk-images about disk images when using the SDK\r\n -help-build-images about disk images when building Android\r\n -help-all prints all help content\r\n\r\n',
stderr: '',
exitCode: 0 }
The result of checking is Android Emulator installed is:

  • stdout: Android Emulator usage: emulator [options] [-qemu args]
    options:
    -list-avds list available AVDs
    -sysdir

    search for system disk images in
    -system read initial system image from
    -vendor read initial vendor image from
    -writable-system make system & vendor image writable after 'adb remount'
    -datadir write user data into
    -kernel use specific emulated kernel
    -ramdisk ramdisk image (default /ramdisk.img
    -image obsolete, use -system instead
    -initdata same as '-init-data '
    -data data image (default /userdata-qemu.img
    -encryption-key read initial encryption key image from
    -logcat-output output file of logcat(default none)
    -partition-size system/data partition size in MBs
    -cache cache partition image (default is temporary file)
    -cache-size cache partition size in MBs
    -no-cache disable the cache partition
    -nocache same as -no-cache
    -sdcard SD card image (default /sdcard.img
    -snapstorage file that contains all state snapshots (default /snapshots.img)
    -no-snapstorage do not mount a snapshot storage file (this disables all snapshot functionality)
    -snapshot name of snapshot within storage file for auto-start and auto-save (default 'default-boot')
    -no-snapshot perform a full boot and do not auto-save, but qemu vmload and vmsave operate on snapstorage
    -no-snapshot-save do not auto-save to snapshot on exit: abandon changed state
    -no-snapshot-load do not auto-start from snapshot: perform a full boot
    -snapshot-list show a list of available snapshots
    -no-snapshot-update-time do not try to correct snapshot time on restore
    -wipe-data reset the user data image (copy it from initdata)
    -avd use a specific android virtual device
    -skindir search skins in (default /skins)
    -skin select a given skin
    -no-skin deprecated: create an AVD with no skin instead
    -noskin same as -no-skin
    -memory physical RAM size in MBs
    -cores Set number of CPU cores to emulator
    -accel Configure emulation acceleration
    -no-accel Same as '-accel off'
    -ranchu Use new emulator backend instead of the classic one
    -engine Select engine. auto|classic|qemu2
    -netspeed maximum network download/upload speeds
    -netdelay network latency emulation
    -netfast disable network shaping
    -code-profile enable code profiling
    -show-kernel display kernel messages
    -shell enable root shell on current terminal
    -no-jni disable JNI checks in the Dalvik runtime
    -nojni same as -no-jni
    -logcat enable logcat output with given tags
    -no-audio disable audio support
    -noaudio same as -no-audio
    -audio use specific audio backend
    -radio redirect radio modem interface to character device
    -port TCP port that will be used for the console
    -ports , TCP ports used for the console and adb bridge
    -onion use overlay PNG image over screen
    -onion-alpha <%age> specify onion-skin translucency
    -onion-rotation 0|1|2|3 specify onion-skin rotation
    -dpi-device specify device's resolution in dpi (default 165)
    -scale scale emulator window (deprecated)
    -http-proxy make TCP connections through a HTTP/HTTPS proxy
    -timezone use this timezone instead of the host's default
    -dns-server use this DNS server(s) in the emulated system
    -net-tap use this TAP interface for networking
    -net-tap-script-up <script> script to run when the TAP interface goes up
    -net-tap-script-down <script> script to run when the TAP interface goes down
    -cpu-delay throttle CPU emulation
    -no-boot-anim disable animation for faster boot
    -no-window disable graphical window display
    -no-sim device has no SIM card
    -lowram device is a low ram device
    -version display emulator version number
    -report-console report console port to remote socket
    -gps redirect NMEA GPS to character device
    -shell-serial specific character device for root shell
    -tcpdump capture network packets to file
    -bootchart enable bootcharting
    -charmap use specific key character map
    -studio-params used by Android Studio to provide parameters
    -prop = set system property on boot
    -shared-net-id join the shared network, using IP address 10.1.2.
    -gpu set hardware OpenGLES emulation mode
    -camera-back set emulation mode for a camera facing back
    -camera-front set emulation mode for a camera facing front
    -webcam-list lists web cameras available for emulation
    -screen set emulated screen mode
    -force-32bit always use 32-bit emulator
    -selinux <disabled|permissive> Set SELinux to either disabled or permissive mode
    -unix-pipe Add to the list of allowed Unix pipes
    -fixed-scale Use fixed 1:1 scale for the initial emulator window.
    -wait-for-debugger Pause on launch and wait for a debugger process to attach before resuming
    -skip-adb-auth Skip adb authentication dialogue
    -metrics-to-console Enable usage metrics and print the messages to stdout
    -metrics-to-file Enable usage metrics and write the messages into specified file
    -feature <name|-name> Force-enable or disable (-name) the features
    -sim-access-rules-file Use SIM access rules from specified file

    -qemu args... pass arguments to qemu
    -qemu -h display qemu help

    -verbose same as '-debug-init'
    -debug enable/disable debug messages
    -debug- enable specific debug messages
    -debug-no- disable specific debug messages

    -help print this help
    -help- print option-specific help

    -help-disk-images about disk images
    -help-debug-tags debug tags for -debug
    -help-char-devices character specification
    -help-environment environment variables
    -help-virtual-device virtual device management
    -help-sdk-images about disk images when using the SDK
    -help-build-images about disk images when building Android
    -help-all prints all help content

  • stderr:
    Exec mono --version
    stdout:
    stderr: 'mono' is not recognized as an internal or external command,
    operable program or batch file.

Error while executing mono --version: Command failed: mono --version
'mono' is not recognized as an internal or external command,
operable program or batch file.

Exec git --version
stdout: git version 2.15.1.windows.2

stderr:
Exec gradle -v
stdout:
stderr: 'gradle' is not recognized as an internal or external command,
operable program or batch file.

Error while executing gradle -v: Command failed: gradle -v
'gradle' is not recognized as an internal or external command,
operable program or batch file.

Exec "C:\Program Files\Java\jdk1.8.0_151\bin\javac" -version
stdout:
stderr: javac 1.8.0_151

System information:
{ procInfo: 'nativescript/3.4.0',
platform: 'win32',
os: 'Windows 10 Pro 6.3.16299',
shell: 'C:\WINDOWS\system32\cmd.exe',
dotNetVer: '4.7.02556',
procArch: 'x64',
nodeVer: 'v8.9.3',
npmVer: '5.5.1',
javaVer: '1.8.0',
nodeGypVer: null,
xcodeVer: null,
xcodeprojGemLocation: null,
itunesInstalled: false,
cocoapodVer: null,
adbVer: 'Android Debug Bridge version 1.0.39',
emulatorInstalled: true,
monoVer: null,
gitVer: '2.15.1.windows.2',
gradleVer: null,
javacVersion: '1.8.0_151' }
Starting watch on killswitch C:\Users\User\AppData\Local\Temp\User\KillSwitches\cli
Looking for project in 'C:\xampp\htdocs{PROJECT-FOLDER}\src'
Project directory is 'C:\xampp\htdocs{PROJECT-FOLDER}\src'.
Installed Android Targets are: [ 'android-23',
'android-24',
'android-25',
'android-26',
'android-27' ]
Directories found in C:\Users\User\AppData\Local\Android\Sdk\build-tools are 26.0.2, 27.0.3
Versions found in C:\Users\User\AppData\Local\Android\Sdk\build-tools are 26.0.2, 27.0.3
Selected version is: 26.0.2
Selected targetSdk is: 26
Directories found in C:\Users\User\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0-alpha1, 24.0.0-alpha2, 24.0.0-beta1, 24.1.0, 24.1.1, 24.2.0, 24.2.1, 25.0.0, 25.0.1, 25.1.0, 25.1.1, 25.2.0, 25.3.0, 25.3.1, 26.0.0-alpha1, maven-metadata.xml, maven-metadata.xml.md5, maven-metadata.xml.sha1
Versions found in C:\Users\User\AppData\Local\Android\Sdk\extras\android\m2repository\com\android\support\appcompat-v7 are 18.0.0, 19.0.0, 19.0.1, 19.1.0, 20.0.0, 21.0.0, 21.0.2, 21.0.3, 22.0.0, 22.1.0, 22.1.1, 22.2.0, 22.2.1, 23.0.0, 23.0.1, 23.1.0, 23.1.1, 23.2.0, 23.2.1, 23.3.0, 23.4.0, 24.0.0, 24.0.0, 24.0.0, 24.0.0, 24.1.0, 24.1.1, 24.2.0, 24.2.1, 25.0.0, 25.0.1, 25.1.0, 25.1.1, 25.2.0, 25.3.0, 25.3.1, 26.0.0
Selected version is: 26.0.0-alpha1
Selected AppCompat version is: 26.0.0-alpha1
Validate options for platform: Android
Initializing analytics statuses.
Analytics statuses: { TrackFeatureUsage: 'enabled', TrackExceptions: 'enabled' }
spawn: node "C:\Users\User\AppData\Roaming\npm\node_modules\nativescript\lib\services\analytics\analytics-broker-process.js" "C:\Users\User\AppData\Roaming\npm\node_modules\nativescript\lib\bootstrap.js"
Searching for devices...
startLookingForDevices; platform is Android
execFile: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "help"
spawn: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "start-server"
Result when throw error is false:
{ stdout: '', stderr: '', exitCode: 0 }
spawn: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "devices"
execFile: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "devices"
Starting Android emulator with image Pixel_2_API_26
spawn: C:\Users\User\AppData\Local\Android\Sdk\emulator\emulator "-avd" "Pixel_2_API_26"
execFile: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "devices"
execFile: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "devices"
execFile: C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb "devices"

@Plamen5kov
Copy link
Contributor

Hi @kamlekar,
In case the device is showing as offline, you can try following this thread and see if it helps. Unfortunately, because the environment is different on every machine, these kinds of problems can be really difficult to figure out.

@Fatme
Copy link
Contributor

Fatme commented Apr 5, 2018

I am closing this due to inactivity. Please fell free to write here or open an another issue in case you have some problems.

@Fatme Fatme closed this as completed Apr 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants