Android SDK not found. - android

Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
This is the problem
Cordova cant acces to the SDK even it is installed , i dont know how to change the default location but i have tried to create the android_home variable but it didnt work .

This problem is connected with actualization of Android. Android depreciated his tool: android, you can check it typing android in command line. You should see:
*************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
*************************************************************************
Invalid or unsupported command ""
Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk
You can solve it updating cordova
npm install -g cordova
and android platform in cordova
cordova platform rm android; cordova platform add android#6.2.3
Source
Cordova: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable

Related

Android SDK not found, even though ANDROID_HOME environment variable is set, also getting perfect result on typing 'android' in cmd

OS : Windows 7
I am getting "Android SDK not found" error in cordova,
I have added environment variable "ANDROID_HOME" in user variable section
C:\Users\KDN\AppData\Local\Android\sdk
and also added "tools" and "platform-tools" in PATH in System variable section
C:\Users\KDN\AppData\Local\Android\sdk\tools
C:\Users\KDN\AppData\Local\Android\sdk\platform-tools
after setting this variables, when I type android in command prompt
C:\Users\KDN>android
I get following result
**************************************************************************
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools\bin\sdkmanager.bat
and tools\bin\avdmanager.bat
**************************************************************************
Invalid or unsupported command ""
Supported commands are:
android list target
android list avd
android list device
android create avd
android move avd
android delete avd
android list sdk
android update sdk
but still when I try to execute
cordova build android
I get following error
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
I am using android version 5.1.1 in cordova and same is installed in SDK too.
check this link Cordova: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable
If not working try to reinstall again.. sometime it doesn't take the values

Setting up Cordova for an Amazon Fire HD 7

I'm struggling to get my development environment set up for Apache Cordova. I'd like to target an Amazon Fire HD 7 running Fire OS 5.3.6.4 (626532920).
Wikipedia tells me that:
The releases are chronologically sorted and categorized based on the underlying version of their Android codebase.
So I'm assuming that this is built on Android 5.1.1 Lollipop?
Project setup
I first installed Cordova using
yarn global add cordova
I then generated a new project using
cordova create hello_world com.mycompany.hello_world HelloWorld
I added Android as the intended platform using
cordova platform add android
(which installed cordova-android#~7.1.1)
Requirements
After running cordova requirements I received the following:
Requirements check results for android:
Java JDK: not installed
Failed to find 'JAVA_HOME' environment variable. Try setting it manually.
Android SDK: not installed
Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
Android target: not installed
android: Command failed with exit code ENOENT
Gradle: not installed
Could not find gradle wrapper within Android SDK. Could not find Android SDK directory.
Might need to install Android SDK or set up 'ANDROID_HOME' env variable.
Some of requirements check failed
I resolved (most of) these issues as follows:
Java JDK
I installed Java 8 using brew cask (as later versions of Java don't seem to be compatible)
brew tap caskroom/versions
brew cask install java8
Android SDK
You first need to create the empty repositories config, otherwise the later steps will fail
touch ~/.android/repositories.cfg
This then left things looking a lot healthier as far as cordova requirements is concerned:
Android Studio project detected
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
No android targets (SDKs) installed!
Gradle: installed /usr/local/Cellar/gradle/4.10.2/bin/gradle
Some of requirements check failed
However I'm struggling with how to set up an Android target for this device.
I think I need to run something like
sdkmanager "platforms;android-27"
But I'm not sure which version of Android I should be using. There is a handy table on the Cordova site but it doesn't make a whole lot of sense to me...

Nativescript Android Emulator Not Running

It's been 4 days since I tried to setup my Android environment but still I get a bunch of errors. I gave up to the point I re-installed my Mac OS, but still found no solution
I installed nativescript as the docs recommended, but when I run tns doctor I get the following error:
✔ Getting environment information
TIP: To avoid setting up the necessary environment variables, you can use the Homebrew package manager to install the Android SDK and its dependencies.
There seem to be issues with your configuration.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.1.2 version and is up to date.
✔ Component tns-core-modules has 4.1.0 version and is up to date.
✖ Component tns-android is not installed.
✖ Component tns-ios is not installed.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods update is not required.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✖ 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 22 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 <=27'.
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.
✖ You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run `$ sdkmanager` to manage the Android Support Repository. In case you already have it installed, make sure `ANDROID_HOME` environment variable is set correctly.
✖ WARNING: CocoaPods is not installed or is not configured properly.
You will not be able to build your projects for iOS if they contain plugin with CocoaPod file.
To be able to build such projects, verify that you have installed CocoaPods.
You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
You have nativescript-cloud extension installed, so you can execute cloud builds, but your environment is not configured properly and you will not be able to execute local builds. To continue, choose one of the following options:
Select "Configure for Local Builds" to run the setup script and automatically configure your environment for local builds.
Select "Skip Step and Configure Manually" to disregard this option and install any required components manually.
? To continue, choose one of the following options: (Use arrow keys)
❯ Try Cloud Operation
Configure for Local Builds
Skip Step and Configure Manually
I checked every error and every URL in every error without figuring this out.
I checked that $ANDROID_HOME is in my ~/.bash_profile as well as $JAVA_HOME.
My ~/.bash_profile have these two paths:
export ANDROID_HOME=/usr/local/share/android-sdk
export JAVA_HOME=/Library/Java/Home
When I run tns doctor and select the 'Configure for Local Builds' it starts re-downloading 'Google Chrome', 'Homebrew', 'Java SE' etc. and even then I still get the same error.
I tried to specify the emulator even then I get the same output as the 'tns doctor' command.
If you don't want to install Android Studio, you can try to follow this step-by-step setup.
On macOS, from my experience the best solution is to install Android Studio.
After that, you can use Android Studio to manage the SDK versions and android emulators (which is better to debug, profile and see logs during development) and accept licenses.
The environment variables (to be added to your bash profile) to point to Android Studio installed SDK and build tools are:
export ANDROID_HOME=/Users/{{ username }}/Library/Android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
Then, restart your computer (otherwise, you probably won't be able to launch emulators from Android Studio). After the restart, open a terminal and type
echo $ANDROID_HOME
to verify that the path is correctly set.

Properly installing Android SDK for cordova on Fedora23

Hi Guys I have been having trouble on setting up my android sdk on my Fedora23 OS this is for a Cordova development. I have checked my Environment Variables on my terminal using echo $ANDROID_HOME and verifying whats installed correctly using cordova requirements command and this is the result it gave me
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Gradle: installed
Requirements check results for ios:
Apple OS X: not installed
Cordova tooling for iOS requires Apple OS X
Error: Some of requirements check failed
How come that the Android Target was not installed while Gradle was installed?
and also how come whenever I tried to use android commands its not working
have I did something incorrect? this is how I setup my android sdk
I downloaded the android-sdk from Android Studio's site
I extracted it using tar command
Moved it to /opt/
Added the android sdk home to my environment at /etc/bashrc
its been two days now and I still dont have it running someone help please
UPDATE
inside my bashrc are the ff:
ANDROID_HOME=/opt/android-sdk-linux/
export PATH="$HOME/opt/android-sdk-linux/android-sdk/tools:$PATH"
export PATH="$HOME/opt/android-sdk-linux/platform-tools:$PATH"
export ANDROID_HOME
I think your bashrc should be
ANDROID_HOME=/opt/android-sdk-linux/
export PATH="/opt/android-sdk-linux/android-sdk/tools:$PATH"
export PATH="/opt/android-sdk-linux/platform-tools:$PATH"
export ANDROID_HOME

Cannot find a compatible Android SDK for compilation when running `tns platform add android`

I am following an official NativeScript tutorial and having a problem configuring my OS X environment for android development.
When running tns platform add android I receive the following error:
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 21 or later.
The tns doctor command also returns warnings on android-sdk issues:
Cannot find a compatible Android SDK for compilation. To be able to
build for Android, install Android SDK 21 or later. Run $ android to
manage your Android SDK versions. You need to have the Android SDK
Build-tools installed on your system. You have to install version 22.
Run "android" from your command-line to install required Android Build
Tools. You need to have the latest Android Support Repository
installed on your system. Run $ android to manage the Android
Support Repository.
My android-sdk installation looks like this:
My .bash_profile also includes the followings:
export ANDROID_HOME="/usr/local/Cellar/android-sdk/24.3.4/"
export PATH="$PATH:~/npm-global/bin:/usr/local/Cellar/android-sdk/24.3.4/tools:/usr/local/Cellar/android-sdk/24.3.4/platform-tools"
Should I go further and try setting system-wide environment variables - not just for the .bash_profile? Also, it is possible that I missed something from the setup process...
Any tip on how I could debug this situation (commands, config files etc.) would be great, thank you!
Alright, so you need to make sure of following:
Make sure you have API 22 installed.
Make sure you you have Android SDK Build Tools 22.x.x installed. (Yes,
specifically 22.x.x)
Make sure you have Android support repository installed. (You can
find it under Extras section in Android SDK Manager)
Once you have performed steps mentioned above, run tns doctor again and you should see No issues were detected message.
This is because of sudo. The root user has no ANDROID_HOME set.
For Windows User:
Run 'android update sdk' from command line
Select Android 5.1.1(API22)
Select Tools folder
Select Extras and click on Install.
ps:- adding this answer, so that if any one land on this page can see it.
Check the ANDROID_HOME is ok
Install the API 22 + ion the Extras > Android Support Repository
Run the following
tns platform remove android
tns platform add android#next
Run
tns run android
then it should be OK
I solve this problem installing Android Support Repository from Extras.
updating SDK in AndroidStudio >> Preferenceswould help
on my windows 10 machine I had to open file explorer right click on this pc and go to properties on the left hand side I had to go to advanced settings. At the bottom I click environment variables then on the android_home variable I clicked edit then pointed it to this path on my machine where the sdk was installed
C:\Program Files (x86)\Android\android-sdk
This answer is on a Linux, not OSX, platform. However, since this is the SO that appears most often for the listed error, I'll share a recent fix that worked for me.
If you have done all of the above and are still getting the error, try this solution.
I am using NativeScript 8.0.2.
You will know that ANDROID_HOME and Java are configured correctly if you can run the command $ANDROID_HOME/tools/bin/sdkmanager --list. If that fails, then first check that your Java is compatible (I had to add OpenJDK 8 and change my PATH with export JAVA_HOME="/usr/lib64/jvm/java-1.8.0/")
In Android Studio, add a previous build tool version. Go to your SDK Manager > SDK Tools, tick the bottom box "Show package details", and add a previous version. In my case, 31.0.0 was the latest, and I added 30.0.3. Now run ns doctor android again and everything should pass.
Seems 31.0.0 is not yet properly recognised by Native Script.
I always got the error "✖ Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later. "
I actually had to go to the android studio settings and install the exact SDK 28 before this error went away.
Android Settings Pic
This is an updated answer, I also had the same issue:
Like all the previous pictures above, I had to install the SDK platforms, using the SDK Manager. From the main screen of Android Studio, click More Actions and choose SDK Manager. Before that I had to add the platform-tools to my PATH in Windows
%LOCALAPPDATA%\Android\Sdk\platform-tools
That fixed my issue and the docs for setup are here.

Categories

Resources