i downloaded the sdk from android official website and installed the latest build tools using android sdk manager. I set android home as said here
but when i run cordova build android i got ANDROID_HOME is not your path.
Then i did as same as here but no luck.
Please help me to solve this.
Please verify that the SDK you downloaded really is located at the location you set. Do this by:
echo $PATH
and
echo $ANDROID_HOME
and verify that the last part of PATH and ANDROID_HOME is identical with where you unzipped the Downloaded zip.
If referring to here than you would have to replace "/opt/android/sdk" with the folder where you unzipped the SDK.
If using sudo you need to either call sudo with sudo -E flag or add the ANDROID_HOME to the Defaults env_keep in /etc/sudoers
Related
Problem: Meteor cannot find my Android SDK when I try to meteor add-platform android on Linux Mint.
I've set my PATH variable: (echo $PATH)
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/jimmy/Android/Sdk/tools:/home/jimmy/Android/Sdk/platform-tools
I've got my ANDROID_HOME variable: (echo $ANDROID_HOME)
/home/jimmy/Android/Sdk
But still, when I run sudo meteor add-platform android --verbose I get:
Adding platform Android to Cordova project
% Adding android project...
android: added platform
Checking Cordova requirements for platform Android
Your system does not yet seem to fulfill all requirements to build apps for
Android.
Please follow the installation instructions here:
https://github.com/meteor/meteor/wiki/Mobile-Development-Install:-Android-on-Linux
Status of the requirements:
✓ Java JDK
✗ Android SDK: Failed to find 'ANDROID_HOME' environment variable. Try setting
setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to
include path to valid SDK directory.
✗ 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.
✗ Gradle: 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.
Okay, so I figured it out? (I guess)
So, I had already had my PATH and ANDROID_HOME set and everything, I could do echo $PATH and echo $ANDROID_HOME and it would print fine; but when I would run the different commands, it wouldn't work.
however, when I run sudo -s and then the commands, it works fine.
Cheers
ANDROID_HOME must be set to Android/Sdk folder. In my case (Ubuntu) it is:
export ANDROID_HOME="/home/***<user name>***/Android/Sdk"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
Put this lines at the end of ~/.profile:
$ gedit ~/.profile
Then $ source ~/.profile
I had the same issue (and now I am stuck to Android target), but to solve Android SDK,
go to Android studio and ensure you remove everything from Android 6,
then that you have Android 5.1.1 installed (with v22 of the platform),
restart your console (I had to restart the laptop)
and normally it doesnt appear again (btw you dont need to use sudo normally)
It's possible that since you're using SUDO - that the PATH / ANDROID_HOME are not present in the root user's session. So try either:
sudo -s
export PATH=...
export ANDROID_HOME=...
meteor ...
or avoid using sudo.
I set the android_sdk_home variable so that my application could find .android when trying to run. Now I get an error stating that "android_sdk_root is undefined".
I am running win 7 with a new installation of Android Studio, inside parallels on a macbook pro.
Thank you for your response. I checked the location and it is identified as the same location as the ANDROID_SDK_HOME environment path. It still says root is undefined. I created an ANDROID_SDK_ROOT enviroment path to the same location and it is still undefined.
This is how I did it on macOS:
vim ~/.bash_profile # macOS 10.14 Mojave and older
vim ~/.zshrc # macOS 10.15 Catalina and newer (using zsh by default)
And added the following environment variables:
export ANDROID_HOME=/Users/{{your user}}/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/{{your user}}/Library/Android/sdk
export ANDROID_AVD_HOME=/Users/{{your user}}/.android/avd
Android path might be different, if so change it accordingly. At last, to refresh the terminal to apply changes:
source ~/.bash_profile # macOS 10.14 Mojave and older
source ~/.zshrc # macOS 10.15 Catalina and newer (using zsh by default)
I received the same error after installing android studio and trying to run hello world. I think you need to use the SDK Manager inside Android Studio to install some things first.
Open up Android Studio, and click on the SDK Manager in the toolbar.
Now install the SDK tools you need.
Tools -> Android SDK Tools
Tools -> Android SDK Platform-tools
Tools -> Android SDK Build-tools (highest version)
For each Android release you are targeting, hit the appropriate Android X.X folder and select (at a minimum):
SDK Platform
A system image for the emulator, such as ARM EABI v7a System Image
The SDK Manager will run (this can take a while) and download and install the various SDKs.
Inside Android Studio, File->Project Structure will show you where your Android sdks are installed. As you can see mine is c:\users\Joe\AppData\Local\Android\sdk1.
If I navigate to C:\Users\Joe\AppData\Local\Android\sdk1\sources you can see the various Android SDKs installed there...
Open the terminal and run the command:
nano $HOME/.bashrc
aggregate the follow line:
export ANDROID_HOME=$HOME/Android/Sdk
export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
Ctrl+o save and ctrl+x close.
And run the command:
source $HOME/.bashrc
echo $ANDROID_SDK_ROOT
MAC - one liner
echo "export ANDROID_HOME=~/Library/Android/sdk \
export ANDROID_SDK_ROOT=~/Library/Android/sdk \
export ANDROID_AVD_HOME=~/.android/avd" \
>> ~/.bash_profile && source ~/.bash_profile
android_sdk_root is a system variable which points to root folder of android sdk tools.
You probably get the error because the variable is not set.
To set it in Android Studio go to:
File -> project Structure into Project Structure
Left -> SDK Location
SDK location select Android SDK location
If you have installed android SDK please refer to this answer to find the path to it: https://stackoverflow.com/a/15702396/3625900
In addition to the above answers, ANDROID_HOME, which also points to the SDK installation directory, is deprecated.
If you continue to use it, the following rules apply:
If ANDROID_HOME is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT.
If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used.
If ANDROID_HOME is defined but does not exist or does not contain a valid SDK installation, the value in ANDROID_SDK_ROOT is used instead.
You need to make a system env variable with the name: ANDROID_SDK_ROOT
and it's value should be C:\Users\your_user_name\AppData\Sdk\tools\bin
worked for me
ANDROID_HOME
Deprecated (in Android Studio), use ANDROID_SDK_ROOT instead.
ANDROID_SDK_ROOT
Installation directory of Android SDK package.
Example: C:\AndroidSDK or /usr/local/android-sdk/
ANDROID_NDK_ROOT
Installation directory of Android NDK package. (WITHOUT ANY SPACE)
Example: C:\AndroidNDK or /usr/local/android-ndk/
ANDROID_SDK_HOME
Location of SDK related data/user files.
Example: C:\Users\<USERNAME>\.android\ or ~/.android/
ANDROID_EMULATOR_HOME
Location of emulator-specific data files.
Example: C:\Users\<USERNAME>\.android\ or ~/.android/
ANDROID_AVD_HOME
Location of AVD-specific data files.
Example: C:\Users\<USERNAME>\.android\avd\ or ~/.android/avd/
JDK_HOME and JAVA_HOME
Installation directory of JDK (aka Java SDK) package.
Note: This is used to run Android Studio(and other Java-based applications). Actually when you run Android Studio, it checks for JDK_HOME then JAVA_HOME environment variables to use.
For macOS with zshrc:
ANDROID_HOME is depreciated, use ANDROID_SDK_ROOT instead
Ensure that Android Build Tools is installed. Check if it exists in your File Directory
Get the path to your SDK. Usually it is /Users/<USER>/Library/Android/sdk
Add ANDROID_SDK_ROOT as a path to your Environment variables:
echo 'export ANDROID_SDK_ROOT=/Users/<USER>/Library/Android/sdk' >> ~/.zshenv
Apply the changes with source ~/.zshrc
Check if it was saved by ...
... checking the specific environment variable echo $ANDROID_SDK_ROOT
... checking the complete list of environment variables on your system env
You can apply this process to every environment variable beeing installed on your macOS system. It took me a while to comprehend it for myself
on Mac edit .bash_profile use code or vim
code ~/.bash_profile
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export ANDROID_HOME=~/Library/Android/sdk
In Android Studio 3.2.1 I got this error because I installed a new API(28) level emulator without installing that API SDK components. After I installed SDK platform and SDK platform tools for the API level 28 and updated Android Emulator the emulator started running.
Hope it may help someone.
This is how to change it :
Step 1 :
Open a Terminal / CMD As Administrator (Right-click on cmd and click "Run as Administrator")
Step 2:
type in " set ANDROID_SDK_ROOT=E:\Android\sdk\ " (type it without the quotes and replace "E:\Android\sdk" with your actual sdk file path location - Mine was : C:\Users\YOUR_ACCOUNT\AppData\Local\Android\Sdk
step 3:
Press "Enter" and i noticed nothing happened
Step 4:
Build your app again and it should reflect your file path.
For me it doisplayed as :
Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\Kurt\AppData\Local\Android\Sdk (recommended setting)
ANDROID_HOME=C:\Users\Kurt\AppData\Local\Android\Sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
I got that info from this site :
https://developer.android.com/studio/command-line/variables#android_sdk_root
Check it out for more information
Have Fun!!
I followed this tutorial to set up my android environment variables I was on mac and I had all the required environmental variable setup and working already. but i was still getting this error that requires environment ANDROID_SDK_ROOT.
I already had an android SDK exported environment variable.
So, what I simply did is adding ANDROID_HOME to the path with the following commands:
export PATH=$PATH:$ANDROID_HOME
and it worked for me on macOS
on mac os
you can try
brew install gradle
A common mistake that people tend to make when setting the root is capitalization errors in the path, or accidental spacing. Hence, I would recommend you check that. If that does not solve it, then check if the folder you are linking to still exists, or was accidentally moved into the trash.
I am trying to migrate my existing project from cordova 2.1 to the latest, 3.1 which can be installev vía command line,
I already have the Android SDK installed,
So:
sudo npm install -g cordova // All good
cordova create hello com.example.hello HelloWorld // All good
cordova platform add android // Then it fires:
Checking Android requirements...
[Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ]
So I installed Macports and tried:
sudo port install android
Which logs:
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
---> Cleaning android
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
Any idea what am I missing here?
It's work cordova Android for MAC 1000000000%. I fought solution and now i'm working try this #Toni Michel Caubet. I will happy to share my Answer.
STEPS:
Open Your Terminal and followed by,
touch ~/.bash_profile
open ~/.bash_profile
PATH="/Users/System-Name/Documents/android-sdk-macosx/sdk/tools:/Development/android-sdk-macosx/sdk/platform-tools:$PATH" (This is Android SDK Location to stored in My system )
4.Save the file and quit the text editor.
5.Execute your .bash_profile to update your PATH:
source ~/.bash_profile
if you want to see your environment path:
7.In your terminal type: set
After you can see like
8.As far as your made it very correct. After your enter command like cordova platform add android. you get following error. because Java SDK doesn't too set environment PATH.
9.open ~/.bash_profile. Add JAVA_HOME value
10.You can see your environment like STEP 7 set. You should be able see:
11.Successfully created environment now you can create Android project with Cordova or PhoneGap
When you installed the Android SDK, it will come with a bunch of folders, like build-tools, platform-tools, tools, and some others. You need to add platform-tools and tools to your main $PATH environment variable.
See the docs here about how to add things to your PATH for whichever system you are on (Windows or Mac): http://cordova.apache.org/docs/en/3.1.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
Here is how you would edit the $PATH on Windows:
Click on the Start menu in the lower-left corner of the desktop,
right-click on Computer, then click Properties.
Click Advanced System Settings in the column on the left.
In the resulting dialog box, press Environment Variables.
Select the PATH variable and press Edit.
Append the following to the PATH based on where you installed the
SDK, for example: ;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools
Save and close both dialogs.
To install the cordova command-line tool, follow these steps:
First of all go through the Cordova Document
For Cordova command-line tools to work, you need to include the SDK's tools and platform-tools directories in your PATH environment. On Mac, you can use a text editor to create or modify the ~/.bash_profile file, adding a line such as the following, depending on where the SDK installs:
export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools
Next Steps:
Download and install Node.js from Here. Following installation, you should be able to invoke node or npm on your command line.
Install the cordova utility. In Unix(Mac), prefixing the additional sudo command may be necessary to install development utilities in otherwise restricted directories:
For Mac $ sudo npm install -g cordova
once successful installation of cordova is done ,now you can create your application
across all the platforms.
Create the Cordova Application
Go to the directory where you maintain your source code, and run a command such as the following:
$cordova create hello com.example.hello CordovaDemo
hello is the directory where you want to create your application
com.example.hello is the package name
CordovaDemo is the name of the Application
Once Successful creation of your project, some file will be created inside the directory i.e hello
Add Platforms
All subsequent commands need to be run within the project's directory, or any subdirectories within its scope:
$ cd hello
Now you need to specify a set of target platforms, Supported OS for Mac
$ cordova platform add android
plz tell me if you are still having problem.
[Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ]
You just need to install the Latest version of Android i.e 4.3
Go to SDK Manager and install the latest SDK Platform.
And try run the command again.
Hope this will help you.
Here it solved my issue:
into the terminal.
touch ~/.bash_profile (create a bash profile)
open ~/.bash_profile (opening a bash profile)
in your opened file, please type the following, Make sure that you have given the correct path, in case you find it difficult to find your directory in which your Android SDK is installed , search into your terminal with ls -l.
PATH="/Users/System-Name/Documents/android-sdk-macosx/sdk/tools:/Development/android-sdk-macosx/sdk/platform-tools:$PATH"
[Let me clarify first that, this is windows specific suggestion, answer]
For particular cordova version there corresponds particular android API
So,
First check out version of cordova with following command:
$ npm cordova -v
In my case cordova version was 1.4.28 , which corresponds to Android API 19
So the bottom line is don't waste time in downloading all "SDK Platforms"
instead just download corresponding Android API for concerned cordova version...
Hope this help....!!!
I have installed the Android SDK but I can't get the Adroid SDK manager to open.
I have looked everywhere on the internet and this is what I have already done which didn't help:
1. run sdk as administrator
2. adding a path pointing to the JDK in all of these forms :
C:\Program Files\Java\jdk1.7.0_21\bin;%SystemRoot%\system32;
C:\Program Files\Java\jdk1.7.0_21\bin;
C:\Program Files\Java\jdk1.7.0_21\
C:\Program Files\Java\jdk1.7.0_21
C:/Program Files/Java/jdk1.7.0_21/bin;
none of them worked ..:-(
3.
Step #1: Open up a command prompt.
Step #2: Use the cd command to move to wherever you installed your Android SDK.
Step #3: Run tools\android.
after doing it I got an error message that said that :
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java installed on your system.
4. deleting 3 times the sdk and reinstalling it.
5. Deleting the .android folder from the user (C:/Users/[User Name]) directory
By the way I have Windows 7 , and I have downloaded the 64 -bits sdk.
I am so helpless.. I ll appreciate a lot a solution...
Shiran
I had the same problem. Try to add an environment variable :
JAVA_HOME : "C:\Java\jdk1.7.0_25\".
It solves problem for me.
WRT Ubuntu 14.04:
You may not have java installed globally in your machine. My fix was to do:
sudo apt-get install openjdk-7-jdk
After was I able to run the SDK Manager.
I have successfully installed Titanium Studio. SDK Version:1.7.5.Now I have downloaded Android SDK from http://developer.android.com/sdk/index.html
Now i am trying configure Android SDK but when i am Providing Path I am Getting Error like" Could not locate the Android SDK at the given path" I have attached Screenshot as well.
Step 1) Download the android SDK From here.
Step 2) unzip android-sdk ( whichever downloaded )
Step 3) In OS X, there is no /opt directory by default. you explicitly have to create it. Run following command.
sudo mkdir /opt
Step 4) Run following command to enter /opt directory.
cd /opt
Step 5) Run following command to create link of android-sdk. Assume that you have android-sdk located under Applications
sudo ln -s /Applications/android-sdk-macosx/ android-sdk
Step 6) enter to android-sdk/tools directory
cd /opt/android-sdk/tools/
Step 7) or directly enter following command in terminal.
/Applications/android-sdk-macosx/tools/android
Step 8) select necessary packages & download them. Sample screen-shot supplied here.
Open this URL - http://developer.appcelerator.com/question/32161/problem-with-the-android-sdk-installation-in-titanium. They have posted a similar kind of Q-A there.
and if you don't want fall in all this steps then just download eclipse and install ADT plugin for eclipse and download all the packages using ADT plugin.
You can get more info here,
http://developer.android.com/sdk/installing.html
I downloaded android SDK using this way in windows and mac both.
After googling i have come to know the all details of Installation of Android SDK in Titanium.Please refer this image.You can find this image at http://developer.appcelerator.com/get_started
Select the directory which holds your Android SDK with the browse button. Type an ending slash ('/') after the path (Android SDK directory). Now you can select your SDK in the popup next to Default Android SDK.
Locate your Android SDK directory, e.g. /usr/local/android-sdk-macos
Create an empty directory named android-7 within the platforms directory:
mkdir /usr/local/android-sdk-macosx/platforms/android-7
Now try again and select the Android SDK directory within Eclipse.