1

I want to connect my virtual android device to nativescript sidekick.

When I open NativeScript Sidekick and click on "Virtual Device Launcher" Button, I get the following error message.

[20-03-24 09:50:23.966] Unable to execute avdmanager, ensure JAVA_HOME is set and points to correct directory

So I ran tns doctor:

TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.

There seem to be issues with your configuration.
Component nativescript has 6.5.0 version and is up to date.
Your ANDROID_HOME environment variable is set and points to correct directory.
WARNING: WARNING: adb from the Android SDK is not installed or is not configured properly.  
 For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements 

WARNING: WARNING: The Android SDK is not installed or is not configured properly. 
 You will not be able to run your apps in the native emulator. To be able to run apps
in the native Android emulator, verify that you have installed the latest Android SDK 
and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements 

WARNING: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later. 
 Run `$ sdkmanager` to manage your Android SDK versions. 

WARNING: You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=29'. 
 Run `$ sdkmanager` from your command-line to install required `Android Build Tools`. In case you already have them installed, make sure `ANDROID_HOME` environment variable is set correctly. 

WARNING: Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable. 
 You will not be able to build your projects for Android.
To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as
 described in http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-win.html#system-requirements 

WARNING: WARNING: The Java Development Kit (JDK) is not installed or is not configured properly. 
 You will not be able to work with the Android SDK and you might not be able
to perform some Android-related operations. To ensure that you can develop and
test your apps for Android, verify that you have installed the JDK as
described in http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html (for JDK 8). 

Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
Your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options: 
Run $ tns preview command to enjoy NativeScript without any local setup.
Run $ tns setup command to run the setup script to try to automatically configure your environment for local builds.
In order to test your application use the $ tns login command to log in with your account and then $ tns cloud build command to build your app in the cloud.
Verify that your environment is configured according to the system requirements described at http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-win.html#system-requirements.

Android Studio Says Android SDK-Tools are installed: enter image description here

ANDROID_SDK_HOME is in my environment variables (user): enter image description here

JAVA_HOME is in my environment variables (system):

enter image description here

When I open cmd and run javac -version I get javac 1.8.0_131

adb devices says List of devices attached (works fine)

Andreas
  • 430
  • 5
  • 21

1 Answers1

2

First option I suggest to you is to run sdkmanager in the command line and try tns run again.

For setting the java_home path this is a link : Setting JAVA_HOME at Android SDK

Second option you may need to change the path of ANDROID_HOME: for example this is mine C:\Users\USERNAME\AppData\Local\Android\Sdk note the sdk at the end of the path

Esdras Zongo
  • 293
  • 2
  • 12