Reputation: 85
I am creating a nativescript app with angular, I am using a json server. I have my json server running and when I run 'tns run android' or 'tns doctor' I get these errors.
× The ANDROID_HOME environment variable is not set or it points to a non-existent directory. You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME
variable to point to the root of your Android SDK installation directory.
× 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: 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
× 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.
× You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=28'.
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.
× 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: 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).
I have installed JDK and android studio, I have installed SDK in android studio.
Upvotes: 0
Views: 1438
Reputation: 28368
Open your environment file (in my case .zprofile
) and add these:
export PATH=~/Library/Android/sdk/platform-tools:$PATH
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/$USER/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/$USER/.android/avd
export JAVA_HOME=/Library/Java/
Make sure that you set your paths to where they're located on your computer as they may not be the same.
Then run source .zprofile
, restart your terminal just in case and then try running tns doctor
again. If you have Android Studio open then restart that as well.
Upvotes: 2