Skip to content

Add support for Android SDK Tools 25.2.3 #2583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eisverticker opened this issue Mar 2, 2017 · 28 comments
Closed

Add support for Android SDK Tools 25.2.3 #2583

eisverticker opened this issue Mar 2, 2017 · 28 comments
Labels
Milestone

Comments

@eisverticker
Copy link

A few days ago i updated my android sdk (with android-studio) and also switched from nativescript 2.4.x to 2.5.2, but during the setup (and also after executing tns doctor) it seems like nativescript is not able to find an appropriate targetSdk

Selected version is:  25.0.2
Selected targetSdk is: undefined
Selected AppCompat version is: undefined

It looks like the cli uses the android command of the sdk tools, but this command is not available anymore

spawn: .../Sdk/tools/android "list" "targets"
Result when throw error is false:
{ stdout: 'The android command is no longer available.\nFor manual SDK and AVD management, please use Android Studio.\nFor command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager\n',
  stderr: '',
  exitCode: 1 }
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

So i am not able to setup android for nativescript.

I am using the android sdk tools version 25.3.1 and NativeScript 2.5.2.

@EricRobertBrewer
Copy link

EricRobertBrewer commented Mar 2, 2017

I experienced the same issue.

What's funny is that I ran android from the command line to update my SDK tools (to 25.3.1). After I updated, I tried to run android again, but it failed.

This SO answer suggests that the previous version of Android SDK Tools be installed.

https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip (for mac).
https://dl.google.com/android/repository/tools_r25.2.3-windows.zip (for windows).

Just replace the old tools/ directory in the folder pointed to by your $ANDROID_HOME.

@Plamen5kov
Copy link
Contributor

@EricRobertBrewer @eisverticker this doesn't look like a NativeScript problem, but a problem with Android Tooling.

@eisverticker
Copy link
Author

@Plamen5kov I don't think so, because if there is an API change in the Android toolings and this causes NativeScript to fail, then it is also a problem for NativeScript or their users as long as it is not documented that newer versions of the sdk don't work with NativeScript.

@c1ngular
Copy link

c1ngular commented Mar 9, 2017

same here , i was reminded by Android Studio of updating new components and itself , then i updated, after that "tns doctor " gives warning like this "Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later."

Android SDK Tools : 25.3.1
Android SDK Platform-Tools:25.0.3

@edwardmhunton
Copy link

After updating Android Studio my gradle failed to sync with this message 'android command is no longer available'

I followed the steps in this thread to try and roll back the Android tooling (downloading the 23.2.3 version) and replacing - however, I still get the same message.

@smazing
Copy link

smazing commented Mar 9, 2017

I'm in the same boat as @edwardmhunton

@petekanev
Copy link
Contributor

https://developer.android.com/studio/releases/sdk-tools.html

It is a change in the SDK tools, and if you've downloaded the latest - then NativeScript may not work for you. I advice downloading the older SDK tools (releases prior to March 2017) as a temporary workaround.

@thisissami
Copy link

Hi everyone. I ended up here after googling the error message I get when I try running android in my terminal. I don't really know much about NativeScript, so maybe this is not useful for you guys, but I'll share anyway...

What previously needed android avg is now its own tool called avdmanager. On my installation of the sdk, android is located at Library/Android/sdk/tools/android, and avdmanager is located at Library/Android/sdk/tools/bin/avdmanager. I hope this is useful for somebody?

@petekanev
Copy link
Contributor

@JocsaPB
Copy link

JocsaPB commented Mar 15, 2017

Maybe it's just inattention when you'll create the path. In my case, this was just innattetion. One / more caused all the problem. Even in creating of the path, even the calling commands together with my variable path.

I hope this tips help you.

@c1ngular
Copy link

has this problem been fixed yet or any time soon ? or should we roll back to older version of Android SDK Tools ? Thanks !

@rosen-vladimirov
Copy link
Contributor

Hey @c1ngular , we are working on the fix and it will be available in @next version of CLI very soon. We are preparing 2.5.3 release of NativeScript CLI, where this issue will be fixed.

@c1ngular
Copy link

@rosen-vladimirov thanks !

@giacomocerquone
Copy link

Same problem here
@rosen-vladimirov thank you very much for all the effort you guys put in this project

@Dutchboy
Copy link

@rosen-vladimirov .... Can you give an estimate on when this is solved? Thanks!!!

@rosen-vladimirov
Copy link
Contributor

@Dutchboy the fix is already in master branch, you can try it by installing @next version of CLI:

npm i -g nativescript@next

We plan to release 2.5.3 in the beginning of the next week :)

@Dutchboy
Copy link

@rosen-vladimirov Thanks!!! And.... How quick your answer!!! Two minutes?!!? THANKS

@grennis
Copy link

grennis commented Mar 17, 2017

@next version worked. Thanks!

@dtopuzov dtopuzov changed the title android command is no longer available Support for Android SDK Tools 25.2.3 Mar 18, 2017
@dtopuzov dtopuzov changed the title Support for Android SDK Tools 25.2.3 Add support for Android SDK Tools 25.2.3 Mar 18, 2017
@dtopuzov dtopuzov added this to the 2.5.3 milestone Mar 20, 2017
@hkirat
Copy link

hkirat commented Jun 28, 2017

Hey
Having this issue again.

@locohost
Copy link

Seems this just goes on forever. Same issue on 10/22/17, NS version 3.2.1

@petekanev
Copy link
Contributor

@locohost Please be more specific, as we won't be able to help you otherwise. Thank you!

@locohost
Copy link

Ok. I'm on Win 8 developer laptop Dell Precision M2800 with 16GB of RAM and nearly half of the 500GB HD empty. I use this laptop for node dev nearly every day.

I'm using the latest NS version 3.2.1. I've fully updated my Android SDK. SDK manager shows no more updates to install. I've run the NS setup process. I've pasted the powershell script line from documentation and run that. What more do I have to do? I'm assuming there are more undocumented steps to get this working. See attached screen cap. Thanks for helping.

nativescript cannot be used cmdr window

@petekanev
Copy link
Contributor

@locohost I noticed several messages that could hint at something you could have missed during the setup.

ANDROID_HOME errors - make sure you have installed the extras packages using the sdkmanager android sdk tools executable ("extras;android;m2repository" "extras;google;m2repository"); Also verify that ANDROID_HOME/tools and ANDROID_HOME/platform-tools are set in your PATH environment variable. Finally you may need to restart the system/relog for the changes to the environment to take effect.

javac error - our android builds do not yet support Java 9, we are working on enabling the use of JDK 1.9. In the meantime please consider setting your JAVA_HOME to point to the Oracle JDK 8 distribution.

@sjordan1975
Copy link

I'm having similar issues as @locohost

I just tried running the NS install script on my Mac:

ruby -e "$(curl -fsSL https://www.nativescript.org/setup/mac)"

This seems to have failed to install Android. Running sdkmanager gives me error:

$ sdkmanager: command not found

I have Homebrew installed which I believe is used as part of the NS install script to attempt to install android-sdk, internally using the following command (or similar):

$ brew cask install android-sdk

However, this fails as I believe the brew is no longer maintained.

So I installed the latest Android Studio and used the embedded SDK Manager; the ANDROID_HOME environment variable by Studio is now set to:

ANDROID_HOME=/Users/<user>/Library/Android/sdk

Also, I have Java 9 installed; I see from the above comment that only Java 8 is supported.

So a few questions:

  • Can I use NS with the latest Android Studio managing the ANDROID_HOME environment variable and no sdkmanager command line?
  • Tips on running Java 8 in parallel to Java 9?

@Plamen5kov
Copy link
Contributor

@sjordan1975:

Can I use NS with the latest Android Studio managing the ANDROID_HOME environment variable and no sdkmanager command line?

It should be no problem using the setup provided with the Android Studio bundle, as long as the $ANDROID_STUDIO environment variable is set correctly.

Tips on running Java 8 in parallel to Java 9?

  • If you start Android Studio from the command line like: ./android-studio/bin/studio.sh it will use whatever environment variables are set in the current terminal. So If you set the export JAVA_HOME ... to java 8 and then start Android studio, it should use java 8.
  • Another way would be using jenv. I haven't tested this way.

@sjordan1975
Copy link

sjordan1975 commented Nov 3, 2017

@Plamen5kov Hi,Thank you for your reply; can you provide a little more instruction.

Thank you for the suggestion of jenv; I have managed to get both Java 8 and Java 9 on my machine.

Inside my NS project, I ran the following command:

tns run android

and got error:

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.

I have latest Android Studio (Android SDK 27)

@petekanev
Copy link
Contributor

@sjordan1975 currently Oracle Java 9 is not supported for NativeScript Android development. Refer to the following comment #2265 (comment).

As for your Android SDK setup - make sure your ANDROID_HOME, ANDROID_HOME/tools and ANDROID_HOME/platform_tools are present in your PATH environment.

@sjordan1975
Copy link

sjordan1975 commented Nov 3, 2017

UPDATE Finally able to get things running by following instructions here

The gist of it seems that as of November 4, the current version of NativeScript does not work with the last SDK; same problem and fix alluded to here

@Pip3r4o Thank you. I've fixed the Java 9 issue.

Here are the relevant variables:

export ANDROID_HOME=/Users/sjordan/Library/Android/sdk
export PATH=$PATH:/Users/sjordan/Library/Android/sdk/tools
export PATH=$PATH:/Users/sjordan/Library/Android/sdk/platform-tools

Running:

tns doctor

Output:

Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ $ANDROID_HOME/tools/bin/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 <=26'.
Run $ $ANDROID_HOME/tools/bin/sdkmanager 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_HOME/tools/bin/sdkmanager to manage the Android Support Repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests