Command Not Found when trying to use the "android" bash command? - android

I am trying to use the android command like this
:~ antonpug$ android list targets
But it doesn't work? I get "command not found". What am I doing wrong?
I installed the SDK. Using Mac OS X.

You need to add the android platform-tools and tools paths to your systems PATH variable. Modify your .profile or .bash_rc file to append the path to the directories in the root of your sdk folder.

Related

How to set NDK Build path in OSX for Android studio

I had set the ANDROID_NDK_HOME as /Users/Shajilshocker/Documents/Android/NDK/android-ndk-r10b using a mac osx application called Environment Variables.
I had confirmed that it set the path correctly in Terminal
echo $ANDROID_NDK_HOME
But when I run a shell file in a Android Studio project which invokes ndk-build I get the following error
ndk-build: command not found
How to make sure that ndk-build is in your build path ?
How to set ndk-build in my build path ?
Thanks for any help
Well, this is actually not enough to make the system aware of the path. You must add this path to the PATH system variable. In your case, all you have to do is to add the following line to your terminal configuration file (which should be under your home directory, named .bashrc if you kept the default terminal, full path: ~/.bashrc):
export PATH=$PATH:/Users/Shajilshocker/Documents/Android/NDK/android-ndk-r10b
What this line does is actually adding the path to your Android NDK directory to the PATH variable. You export a variable named PATH with its current content plus the directory of your NDK.
Step by step:
Go in the home directory
Edit .bashrc
Add the line I showed above
Save, exit, then restart bash (you just have to type bash, then enter)
For mac use this: Open your .bash_profile file with a text editor. .bash_profile is by default found in home directory. Eg /Users/john
the assumption is: you have downloaded the android sdk and ndk to /User/john/Android or you can find the path from Android Studio by going to
Project Structure > SDK Location, pay attention to Android SDK location & Android NDK location
export ANDROID_SDK=/Users/john/Android/sdk
export ANDROID_NDK=/Users/john/Android/sdk/ndk-bundle
export PATH="$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK"
Then save the above lines to your .bash_profile file. Close it and try typing this on your terminal
ndk-build
if the response is like below, you are good to go
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/Users/john/Android/sdk/ndk-bundle/build/core/build-local.mk:143: *** Android NDK: Aborting . Stop.
The assumption here is you have downloaded your android sdk to /Users/john/Android
In case this helps anyone, I installed the Android NDK using Android Studio on MacOS by following the instructions on the android.com NDK webpage: I selected Tools --> Android --> SDK Manager and then selected NDK. Android Studio then installed the downloaded files under:
/Users/user.name/Library/Android/sdk/
That directory is the same one that is listed on the SDK Manager window inside Android Studio. Underneath that directory is another directory ndk-bundle, which has all the NDK tools.
Thus, I added this to my path:
/Users/user.name/Library/Android/sdk/ndk-bundle/
cd to path you have to set.
Enter in Terminal: echo "export PATH=$PATH:$ANDROID_NDK_HOME" | sudo tee -a /etc/profile

Launch Android SDK manager - Tools directory doesn't exist? Mac

I'm on mac, I think I've done everything right so far. following these instructions:
http://developer.android.com/sdk/installing/adding-packages.html
it says to navigate to tools/ directory in terminal. Here are my steps.
Open terminal
cd Applications
result is: No such file or directory
path to my tools directory is as follows
Applications->adt-bundle-mac-x86_64-20130219 ->SDK -> tools
I tried putting my folder onto my desktop, both the tools folder, and my adt-bundle because I could change directory to my desktop, and when I enter ls to the terminal I see my tools folder, and my adt-bundle is there,
but the problem is when I try to enter
cd tools
or
cd adt-bundle(etc...)
it says that it is not a directory.
what do I do?
Go to this directory:
cd /adt-bundle-mac-x86_64-20131030/sdk/tools
and run:
./android
I recently encountered this issue, and figured I'd post on this for clarification or for anyone still encountering it.
It seems you have to be at the root of the /adt-bundle-mac-VERSION/sdkdirectory in order to execute the "android" command.
I normally cd into the directory until I reach the location of the command, but in this case I encountered the same issue as the original poster.
You must use the tab key to the android command...
ie...
locate your installation /adt-bundle-mac-x86_64-20131030/sdk hit TAB key /tools hit TAB key /android
instead of cd adt-bundle-mac-x86_64-20131030/ cd/sdk cd/tools android
If done properly the SDK manager should launch for you.
Hope this helps anybody out there.
You can launch the SDK Manager by using the GUI:
Launch Android Studio
Create a new blank project
In the toolbar, look for the icon with tooltip "SDK Manager"
A lot of answers have been given here that you should go to /{path-to-your-android-sdk}/tools
and run ./android.
For me, this did not work. When I opened the android file located at my /{path-to-your-android-sdk}/tools directory with a text editor, it contained the following:
#!/bin/bash
echo The "android" command is no longer available.
echo For manual SDK and AVD management, please use Android Studio.
echo For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
exit 1
So the right approach now, is as stated by #Shijil in his comment.
In the directory for your android sdk, you should use:
For SDK Manager:
cd tools
cd bin
./sdkmanager
For AVD Manager:
cd tools
cd bin
./avdmanager
NB For the last command in each of the options above, you will have to supply additional args depending on the operation you want to perform. An example arg that works for both is --list. Running the commands without any args will only display the possible args you could have passed.
Personally, I think using the GUI in android studio is easier. Especially for linux beginners.
Use cd /users/user/...your path.../android-sdk/tools
and then :
./android
Here is your "tools" directory for Android Studio in OS X El Captain(Yosemite also has the same path hopefully):
Users/user-name/Library/Android/sdk/tools
In the terminal, just type: Library/Android/sdk/tools
and hit enter. And you are in the tools folder.
Please note that user-name refers to the mac user
Better open terminal and type which android.
It will tell you the path where you have the package installed.
Then yeah, you just have to execute that path on the terminal.
Your android package might have been installed with Homebrew or others, so the path can be different.
Edit: typo
For me the directory was cd /Users/your_user_name/Library/Android/sdk/tools/
and after that the command was ./android list targets
I hope this can help

What environment variable to set for "android update project -p ..."

I'm trying to set up ANT for my Android project. According to the Android website, the command to use is
android update project -p name
Unfortunately, the command "android" is not available on my command line (Windows 7).
Can you please tell me what kind of environment variables do I have to set up? The SDK is located in C:\Program Files (x86)\Android\android-sdk, I assume I will need that.
Do I just have to extend "path" or is there the need to create new variables (something like "JAVA_HOME", but for android).
Thank you
C:\Program Files (x86)\Android\android-sdk\tools
C:\Program Files (x86)\Android\android-sdk\platform-tools
are both valuable to have on the path. I don't remember which has the android binary, but, with both, you will definitely get it. With both you will also get adb and progaurd.
And also, extend PATH don't create a new one.

how can i launch the android tool?

I need to do somethings that must be done from the command prompt of the android tool.
but every one says it's in the platform tools folder in the sdk path but which file is it?
that might help:
the contents of platform tools folder:
aapt.exe
adb.exe
aidl.exe
dexdump.exe
dx.bat
fastboot.exe
llvm-rs-cc.exe
source.properties
AdbWinApi.dll
AdbWinUsbApi.dll
Did you mean android Adb command lin tool if so see this link
if you want to manage emulator from command line see these three link it will help you a lot
Android Emulator
Using the Android Emulator
Android Emulator on Linux
There is an android command, but it's not an executable - run the android.bat in the tools directory, and you should be able to make the changes you need. If you add the tools directory to your system path, you'll be able to run android from any directory when using the command line.

How to Configure Android SDK for Titanium in Mac OS Lion?

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.

Categories

Resources