Android SDK installed but not seen by cordova - android

I've installed android studio 3 which sees android-sdk:
The same path I have in enviroments variables but I cannot use android sdk with cordova. (I'm makeing ionic app).
Here is screen shot from IDE:
Edit:
More screenshots:

What cordova is looking for at this step is not the sdk but the sdk tools. Have you installed the sdk tooks (middle tab in your first picture)?
To know what exactly is missing you can use the command
cordova requirements android --verbose
It will show you that cordova is trying to launch the command %ANDROID_HOME%\tools\bin\avdmanager.bat list target and displays that the SDK is not found if the command is not found.

Related

Ionic can not add android

I try to uninstal cordova then instal again but still not working
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd platform add android exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.
It looks like you need to install your android SDK/build tools.
You can do it manually or using your android studio installation if exists.
To do it with Android Studio you can:
Go to settings->Appearance and Behavior->Android SDK
Go to the SDK Platforms tab and select the latest Android SDK
package.
Go to the SDK Toos tab and select the following checkboxes:
Android SDK Build-Tools
Android SDK Platform-Tools
Android SDK Tools
NDK
Android Support Repository
Google Repository
Apply and accept
To do it without using Android Studio there's an answered question here: How do I download the Android SDK without downloading Android Studio?

Cordova not building app

I am new to cordova. Trying to work out with it but when I check requirements it says Android Target not installed while I have installed SDK in Android Studio.
Required information for troubleshooting can be found here.
I am using Windows 8.1 32 bit installation. I have already tried previous answers found oh the site.
Update
I just noticed that running cordova build android gives
D:\Android\Apps\hell>cordova platform ls
Installed platforms:
android 7.0.0
Available platforms:
browser ~5.0.1
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0
Indicating android version to be 7.0.0 thus API is 24.
But D:\Android\Apps\hell\platforms\android\CordovaLib\project.properties have :
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-26
apk-configurations=
renderscript.opt.level=O0
android.library=true
Here target is set to android-26, which is Android 8.0
From what I can tell the path setting for the SDK is missing. Check the Cordova documentation for that. Follow it to the letter.
Also Android 7.0.0 is not the version of Android, but of the Cordova code for Android.
Josem might be onto something as well, unless you've already done that step.
Perhaps the platform android is not installed.
Can you see it?
ionic cordova platform list
If it is not there, you can add it:
ionic cordova platform add android
Here is the documentation.

Compatible Android SDK Error on Nativescript 3.0.3

I need help. :(
I was studying Nativescript these past days. And now, I've managed to create an app using the tutorial and I'm currently trying to build it on an Android device to test. When I tried running it using tns run ios, it runs smoothly on an ios emulator. But when I tried running tns run android I got these error.
The plugin tns-android#3.0.1 is already installed
TypeError: Path must be a string. Received undefined
# run android
and sometimes..
this..
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
(when I tried to run several solutions like export android sdk, etc...)
I have several Android SDK installed (Please refer to the screenshot below)
Android SDK Screenshot
I've validated if my Android SDK url is correct by running:
ls $ANDROID_HOME
also..
ls $ANDROID_HOME/platforms
**which shows the ANDROID SDK files.
Lastly, here's my configuration:
OS: Mac Sierra Version 10.12.5
NPM: 4.6.1
Node: v6.10.3
Nativescript: 3.0.3
What should I do? Please help. :(
Thank you in advance.

Meteor 1.3.3 on Mac running android: Android target: Android SDK not found

For a client of mine, I try to run the meteor run android command on a mac and I got the following message:
✓ Java JDK
✓ Android SDK
✗ Android target: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
The situation so far:
PATH is correctly defined with links to the tools and to the platform-tools, ANDROID_HOME is fine too
The emulator and the SDK are installed with Android Studio
gradle is not found either, the tools/templates/wrapper path does not exist, which make me suspect a bad SDK installation, yet Android Studio handles everything
Meteor version is 1.3.3 for this project, and of course android paltform has been added to the project, which run fine on my Linux laptop
Verbose is not that verbose, in which situation Android SDK is okay and Android target is not ?
This is very hard to debug and I am desperate to find a solution, this issue seems unresolved in other related threads. Thanks for your help!
This is actually a bug due to the new version of the Android SDK Tools (> 25.3).
The solution is to go back to 25.2.x, the Meteor guide mobile page has been updated a few hours ago.
See the related Github issue
Links to download 25.2.5 version:
https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
https://dl.google.com/android/repository/tools_r25.2.5-macosx.zip

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