NatvieScript Installation Error(windows) - nativescript

I have a problem completing NativeScript installation requirement. I got stuck at number 5 in the installation guide available here.
When i run the command "tns doctor" in the command prompt, i get the error message below:
Cannot find a compatible Android SDK for compilation. To be able to
build for An droid, install Android SDK 22 or later. Run $
%ANDROID_HOME%\tools\android to manage your Android SDK versions.
You need to have the Android SDK Build-tools installed on your system.
You can i nstall any version in the following range: '>=23 <=27'. Run
$ %ANDROID_HOME%\tools\android from your command-line to install
required An droid Build Tools.
You need to have Android SDK 22 or later and the latest Android
Support Reposito ry installed on your system. Run $
%ANDROID_HOME%\tools\android to manage the Android Support Repository.
I have installed the required sdk and i am still getting the same error message and every time i execute this script in the console, it takes like forever to complete:
"%ANDROID_HOME%\tools\bin\sdkmanager" "tools" "platform-tools"
"platforms;android-25" "build-tools;25.0.2"
"extras;android;m2repository" "extras;google;m2repository"

Related

Nativescript doctor throws warnings and errors

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:
ANDROID_SDK_HOME is in my environment variables (user):
JAVA_HOME is in my environment variables (system):
When I open cmd and run javac -version I get javac 1.8.0_131
adb devices says List of devices attached (works fine)
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

NativeScript for Windows error: Android SDK Build-tools v29 You can install any version in the following range: '>=23 <=28'

When trying to follow the NativeScript for Vue Quick Start here: https://nativescript-vue.org/en/docs/getting-started/quick-start/
in June 2019, the Android SDK is version 29.
At the command $ tns run android --bundle or when running tns doctor I get the following error: You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=28' and yes, I also get the message Your ANDROID_HOME environment variable is set and points to correct directory. BUT of course it is version 29, not '>=23 <=28'
Other SO responses do not seem to address this problem.
How to install an older version in this case?
In the Android SDK manager, go to the SDK Tools tab and then select the Show Package Details checkbox. Older versions will then be displayed.

NativeScript Installation Issues

I was just trying to install NavtiveScript, for this I followed the official installation guide available at
http://docs.nativescript.org/angular/start/quick-setup but I am stuck at "Step 3: Install iOS and Android requirements"
When I run the below command in Command Prompt (with administrative privileges)
#powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Everything seems to be installed without any issue. But when I try to verify the installation through command, "tns doctor" I returns below warnings:
D:\>tns doctor
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
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ android 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 <=24'.
Run android from your command-line to install required Android Build Tools.
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ android to manage the Android Support Repository.
Can anyone please guide?
I am using Windows 10, and have Visual Studio 2015 (update 3) and Visual Studio Code installed on my machine.
The command line of installing Android also didn't work for me and gave me the same errors as you. I figured out this by downloading and installing Android Studio. After your installation, you should be able to find the location of the android sdk, which is /Users/myMacUserName/Library/Android/sdk in my situation. And you could select all the needed things through SDK Manager. In the terminal, you then do 'export ANDROID_HOME=/Users/myMacUserName/Library/Android/sdk' instead of the command from NativeScript installtion instruction 'export ANDROID_HOME=/usr/local/opt/android-sdk'. After all these, you should be okay with the Android SDK errors.
https://developer.android.com/studio/index.html
Install the android studio from the above link and then after that run the studio and install the desired android sdk packages from within the studio.

Nativescript. Execution failed for task ':mergeF0DebugResources'

I am getting the following exception Execution failed for task ':mergeF0DebugResources.
When running 'tns build android' or 'tns run android --emulator'
tns version: 2.0.1
java version "1.8.0_92"
This error typically means your platform folder has been messed up. Typically in v2.0x of NativeScript this is typically caused because you added or removed a plugin. In the next (hopefully) version this should be fixed.
However, in the meantime to "fix" this error all you typically need to do is:
tns platform remove android
then
tns platform add android
The other possibility is that you do not have the android sdk installed properly. If you type "android" at a command/terminal window, does it show that you have all the following installed:
Android SDK Tools
Android SDK Platform Tools
Android SDK Build Tools
At least one of the SDK's, 4.4.2 and higher
Android Support Repository
Android Support Library
All of them must be showing that they are installed.

ionic-box vagrant box - Install Android target: "android-22"

I'm using the latest ionic-box as of 27th April 2015. I've been able to ionic platform add android but getting the following error when ionic build android:
[Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: /home/vagrant/android-sdk-linux/tools/android
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)]
I've tried updating the sdk with the following command
android update sdk --no-ui
where I get the output of fetching a number of "https://dl-ssl.google.com/android*" File not found. However, if i copy that url and paste it on a browser the file is there.
My vagrant box is now bridged on the network to have direct access to the internet, since NAT was giving me the same errors.
Any help is much appreciated.
Follow these steps.
1) Type android on command line.(Make sure ANDROID_HOME and PATH are set properly)
2) Select API 22 from the populated list.
3) Click install packages.
4) Type android avd on command line.
5) Set API level and other config.
6) Now type ionic build android.
i work around this by changing https to http or vise versa, in options but as a quick fix
for supporting andorid API 21 like #astroanu commented this will help. it will add the support of API 21 in project.
$ cordova platforms remove android
$ cordova platforms add android#3.7.1
I was able to build an android apk by doing the following:
Open up the SDK manager after downloading/installing the android SDK (android studio). AndroidStuido>Appearance&Behavior>System Settings>Android SKD. Alternatively, you can just click on the "SDK Manager" button on the "Welcome to Android Studio" window that appears when you open Android Studio.
Under SDK Platforms, click on Android 5.1.1 - API Level 22 and hit apply to install the package.

Resources