Skip to content

Android emulator not working #4596

Open
@voigtd

Description

@voigtd

environment:

  • NativeScript: 5.3.4
  • Node: 10.15.3
  • MacOS Mojave: 10.14.3
  • Android Studio: 3.4

I'm getting an error when trying to open the android emulating by running tns run android --bundle. iOS is working fine. I initially installed via Homebrew (following the instructions from the docs), and then after that didn't work I installed the sdk via Android Studio and changed my ~/.bash_profile accordingly.

tns doctor says that everything should be working. Tried a lot of things to debug but haven't found a solution.

the error I get when I run tns run android --bundle is the following:

Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
Cannot find connected devices.
Emulator start failed with: No emulator image available for device identifier 'undefined'.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.

When I run tns device android --available-devices it shows installed devices while simultaneously saying that devices weren't found:

Available emulators
┌─────────────┬──────────┬───────────┬───────────────────┬──────────────────┬────────────┐
│ Device Name │ Platform │ Version   │ Device Identifier │ Image Identifier │ Error Help │
│ Pixel2      │ Android  │           │                   │ Pixel2           │            │
└─────────────┴──────────┴───────────┴───────────────────┴──────────────────┴────────────┘

Connected devices & emulators
Searching for devices...
Cannot find connected devices. Reconnect any connected devices, verify that your system recognizes them, and run this command again.

When I run tns run android --log trace I get the following error:

Loading extensions.
Asserting extension nativescript-cloud is installed.
Extension nativescript-cloud is installed.
Trying to get macOS version.
Exec system_profiler SPSoftwareDataType -detailLevel mini
 stdout: Software:

    System Software Overview:

      System Version: macOS 10.14.3 (18D42)
      Kernel Version: Darwin 18.2.0
      Time since boot: 4:19


 stderr:
macOS version based on system_profiler is 10.14.
Looking for project in '/Users/daniel/Desktop/ng-ns-demo'
Project directory is '/Users/daniel/Desktop/ng-ns-demo'.
System information:
[Object: null prototype] {
  platform: 'darwin',
  shell: '/bin/bash',
  os:
   'Darwin Daniels-Mac 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64\n',
  procArch: 'x64',
  nodeVer: '10.15.3',
  npmVer: '6.4.1',
  nodeGypVer: null,
  nativeScriptCliVersion: '5.3.4',
  gitVer: '2.18.0',
  dotNetVer: null,
  javacVersion: '1.8.0_212',
  javaVersion: '1.8.0_212',
  adbVer: '1.0.41',
  androidInstalled: true,
  monoVer: null,
  gradleVer: null,
  isAndroidSdkConfiguredCorrectly: true,
  xcodeVer: '10.2.1',
  xcodeprojLocation: '/usr/local/bin/xcodeproj',
  itunesInstalled: true,
  cocoaPodsVer: '1.6.1',
  isCocoaPodsWorkingCorrectly: true,
  isCocoaPodsUpdateRequired: false,
  pythonInfo: { isInstalled: true, isSixPackageInstalled: true } }
Initializing analytics statuses.
Analytics statuses:  { TrackFeatureUsage: 'disabled', TrackExceptions: 'disabled' }
Your ANDROID_HOME environment variable is set and points to correct directory.
Your adb from the Android SDK is correctly installed.
The Android SDK is installed.
A compatible Android SDK for compilation is found.
Javac is installed and is configured properly.
The Java Development Kit (JDK) is installed and is configured properly.
Installed Android Targets are:  [ 'android-28' ]
Directories found in /Users/daniel/Library/Android/sdk/build-tools are 28.0.3
Versions found in /Users/daniel/Library/Android/sdk/build-tools are 28.0.3
Selected version is:  28.0.3
Selected targetSdk is: 28
Validate options for platform: Android
Skipping node_modules folder! Use the syncAllFiles option to sync files from this folder.
Searching for devices...
startLookingForDevices; platform is Android
Options for ios-device-discovery { platform: 'Android',
  shouldReturnImmediateResult: false,
  emulator: false }
spawn: /Users/daniel/Library/Android/sdk/platform-tools/adb "start-server"
Result when throw error is false:
{ stdout: '', stderr: '', exitCode: 0 }
spawn: /Users/daniel/Library/Android/sdk/platform-tools/adb "devices"
spawn: /Users/daniel/Library/Android/sdk/platform-tools/adb "devices"
spawn: /Users/daniel/Library/Android/sdk/tools/bin/avdmanager "list" "avds"
spawn: /usr/local/bin/VBoxManage "list" "vms"
spawn: player 0
Configuration error for Genymotion { stdout: '', stderr: 'spawn player ENOENT', exitCode: 'ENOENT' }
spawn: /usr/local/bin/VBoxManage "guestproperty" "enumerate" "e58dcf62-74df-43eb-858a-07faa6606f14"
No emulator image available for device identifier 'undefined'.
Cannot find connected devices.
Emulator start failed with: No emulator image available for device identifier 'undefined'.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.
Error while initializing devicesService: Exception: Cannot find connected devices.
Emulator start failed with: No emulator image available for device identifier 'undefined'.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.
Error: Cannot find connected devices.
Emulator start failed with: No emulator image available for device identifier 'undefined'.
To list currently connected devices and verify that the specified identifier exists, run 'tns device'.
To list available emulator images, run 'tns device <Platform> --available-devices'.
    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:126:28)
    at Errors.failWithoutHelp (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:136:21)
    at DevicesService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:445:34)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/nativescript/lib/common/mobile/mobile-core/devices-service.js:11:65)
    at process._tickCallback (internal/process/next_tick.js:68:7)

My ~/.bash_profile file currently is the following:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
export ANDROID_HOME=/Users/daniel/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/daniel/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/daniel/Library/Android/sdk/.android/avd

Also, I'm getting the following error after running: /Users/daniel/Library/Android/sdk/tools/bin/avdmanager list avd:

The following Android Virtual Devices could not be loaded:
    Name: Pixel2
    Path: /Users/daniel/.android/avd/Pixel2.avd
   Error: Google pixel_2 no longer exists as a device

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions