Tns doctor error, running android fails


#1

HI I am getting errors trying to run $ android. Error is ‘android’ is not recognized as an internal command, operable program or batch file.

When I run $ tns doctor it says “Cannot find a compatible Android SDK for compilation…” and “You need to have Android SDK 22 or later…” I have sdk version 25.0.2 so that shouldn’t be the problem.

I did change my ANDROID_HOME = “C:\Users\Tre’\AppData\Local\Android\sdk” because the original path didn’t exist on my machine.

I installed on a windows pc.

Any guidance would be appreciated. Thanks in advance.


#2

run the command android immediately opening the command prompt not $ android


#3

android fails. Any other suggestions? I wonder what folder should be the target location for ANDROID_HOME?


#4

How did you install your android sdk?


#5

The Nativescript install script failed so I installed from the Android website (https://developer.android.com/studio/install.html). After installing from the website I used the tns doctor command. That’s when I got the errors in the original post.


#6

@trewaters if you have already done the first two steps which I presume you have done
https://docs.nativescript.org/start/quick-setup

then run this in commad
@powershell -NoProfile -ExecutionPolicy Bypass -Command “iex ((new-object net.webclient).DownloadString(‘https://www.nativescript.org/setup/win’))”

or try the new setup installer
https://docs.nativescript.org/start/ns-setup-installer

because what I always do for all my installations is I follow the first 2 steps then I run
@powershell -NoProfile -ExecutionPolicy Bypass -Command “iex ((new-object net.webclient).DownloadString(‘https://www.nativescript.org/setup/win’))” which handles all my other requirements for the environment and been doing it for mostly windows 10 machines. works perfectly. So I thought you could try that.

or Remove the android and reinstall with the NativeScript docs approach


#7

I checked my SDK directory and PATH variable Very similar to yours:

C:\Users\randy\AppData\Local\Android\android-sdk

Are you forgetting the android-sdk at the end?

Randy


#8

My install location doesn’t have a folder android-sdk so I changed the PATH from what you have to this

C:\Users\Tre’\AppData\Local\Android\sdk

If I use the PATH you show I still get errors about not recognized as an internal or external command when I try to run android from the command line.

That’s why I think there is a PATH issue. I have a ton of folders under “sdk” I wonder if using one of them will help the problem. I have no clue which to choose.


#9

in your case the android.bat file should be in sdk/tools directory.

Also remember after you change the path you have to close and re-open the command line


#10

I will try to uninstall and re-install NativeScript, but I found this link ( https://developer.android.com/studio/tools/help/android.html ). Sounds like the “android” command is no longer supported.

I also tried updating the ANDROID_HOME location to C:\Users\Tre’\AppData\Local\Android\sdk\tools with no luck.

I have to run but I will work on this some more in the morning.

Thanks to everyone for your help. I will keep people updated as I find more information.


#11

Is that directory actually where your Android SDK is installed? I just went through the install process today, and although it set my ANDROID_HOME to Users\Me\AppData\Local… , where it actually installed the SDK was Program Files\Android. I didn’t tell it to do that, it’s just apparently the default, or at least it was for me. All I had to do was change the ANDROID_HOME to point to C:\Program Files\Android\android-sdk, and it worked fine.

If you’re sure you installed the SDK, you might try just searching your hard drive for ‘Android’ or ‘android-sdk’ to find what folder it’s actually in and point your ANDROID_HOME at that, and then of course also make sure the android-sdk\tools and android-sdk\platform-tools folders are in your path (although in my case, at least, the Path was already correct; only ANDROID_HOME was wrong).


#12

The 2.5 CLI simply has no support for the breaking change updates that Platform-Tools 25.3.0 brought along. A temporary workaround until NativeScript 3.0 lands is to download a new Android SDK package and install any previous Platform-Tools version (i.e. 25.2)


#13

Thanks for the answer! I also went to stackoverflow and got this answer that helped me pass the tns doctor warnings.

http://stackoverflow.com/questions/42708185/nativescript-tns-doctor-error/42715974#42715974

Now I can build the HelloWorld. I am glad this wasn’t me. Sounds like I was lucky enough to get into NativeScript when there was a breaking change from Android SDK.


#14

Yeah. You can track this issue to see when/if it’ll be fixed.


#15

They are releasing a fix soon!

There was a post today on the thread fuzzybear3965 posted above.


#16

i am also having an error problem also. when i run the nativescript app it opens in genymotion and doesnt get inside the app. all the screen displays is the nativescript splash screen