Nativescript doctor throws warnings and errors - nativescript

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

Related

NatvieScript Installation Error(windows)

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"

Ionic trouble: can't build to android

I've got an Ionic 3.4 project and trying to build it to Android for testing purposes.
I installed Android Studio and the Android SDK, aswell Java 8. Then did:
ionic cordova platform add android
Then, when I write...
ionic build android
... I get the following error:
cordova build android ✖ Running command - failed!
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit
code 1):
ANDROID_HOME=C:\Users\Zerok\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
What's going on? I also installed Gradle 4.0 into the Java folder, and pointed towards it in the GRADLE_HOME environment variable:
Var name: GRADLE_HOME
Value: C:\Program Files\Java\gradle-4.0
Also added the following to the path:
GRADLE_HOME\bin
But it still throws the same error... I don't think it's a problem with plugins, but with the Ionic/Cordova build system. What I don't understand, is why it needs Gradle when it's perfectly working in Android Studio, maybe it's because it's not in C:/, but a different disk? Any ideas?
(Assuming Windows 10)
open Start Menu, type path and hit Enter
System Properties will open. On the bottom click Environment Variables...
In the window that opens, on the bottom section named System Variables, double click Path
Click New and copy paste the path to your gradle installation
Make sure the path environment variable points to the bin folder of gradle like so: export PATH="$PATH:/home/jeffbl/android-studio/gradle/gradle-3.2/bi‌​n".
If that doesn't work try:
$ cordova platform rm android && cordova platform add https://github.com/apache/cordova-android && cordova build
If that doesn't work then use the SDK manager to downgrade to an earlier version of your SDK. It might be that there is no graddle wrapper out yet for the latest.
In any case you will find the answer to your problem in this github issue.
Ok, I already fixed it. And the fix is weird as hell, but well, at least it works.
Solution: uninstall Android Studio and install it in the main drive (C in my case). Everything began to work perfectly after this clean install.

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.

sqlite in the xamarin android player

I have clicked on Tools -> Android -> Android Device Monitor in VS 2015 and got the following error, but my xamarin android player works fine.
Is there a way to access to local database (sqlite) in the xamarin android player simulator not on the physical device?
Update:
I am using adb and getting the following error
Failed to load the JNI shared library "C:/XXXXX/jvm.dll"`.
This is a sign of a mixed 32/64 Java bit Java install and/or the wrong version is installed.
Xamarin on Windows requires a Windows x86 version of v1.7
It is essential to install the 32-bit version of the Java JDK even if you're using 64-bit Windows. It is also important that v1.7 of the Java JDK is installed (although it is fine to have 1.8 or newer installed at the same time).
So I would start by installing Java v1.7, since the error is pointing to v1.6 and retrying to open the Android Device Monitor.
Installing the Java SDK (JDK)
The JDK can be downloaded from any browser by visiting Oracle’s website and browsing to the section with the heading Java SE Development Kit 7u79
Ref: https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/#Installing_the_Java_SDK_JDK
Solution 1:
I run tools->android-> android adb command prompt in visual studio
I have followed the followings to access the database
step1. >adb shell
step2. >cd data/data
step3. >ls -l|grep "com.xxxx"
step4. >cd "com.xxxx"
Then I used the following to copy sql file to my workstation
adb shell "run-as com.xxxx chmod 666 /data/data/com.xxxx/files"
adb pull /data/data/com.xxxx/files/xx.sql
adb shell "run-as com.xxxx chmod 600 /data/data/com.xxxx/files"
Then I have downloaded sqlite browser to open the file and see the tables.
Solution 2:
Alternatively, you can go to following directory and double click the exe file
C:\Users\XXXXX\AppData\Local\Android\ANDROI~1\tools\lib\monitor-x86_64\monitor.exe

Resources