where can I " adb install "? - android

I am using Ubuntu for developing my 1st android. I have a problem and the solution is to adb install DataAttach.apk .
my problem is, where can i do adb install DataAttach.apk?
i tried this:
$ cd android-sdk-linux/
$ adb install DataAttach.apk
adb: command not found
do anyone can give me an idea about my case?

1)Open the terminal and move to android-SDK-Folder.
2)Go to platform-tools.
3)check for the existence of adb by using ls command
4)then try using adb as shown below
./adb install project.apk
That's it.

You should add the adb command to your $PATH variable.
On ubuntu, you should add these lines to your ~/.bashrc file:
export ANDROID_HOME=(path to your android-sdk/folder)
export PATH=$PATH:$ANDROID_HOME/platform-tools
and finally, restart your system, and that should work.

Related

Android studio ADB not responding. manually kill "adb" and click 'Restart'

I am running my Android studio on Ubuntu 14.04,its was working fine but suddenly its shows the following error while do build my project.
Error message:
ADB not responding. If you'd like to retry, then please manually kill "adb" and click 'Restart'
I have tried the following in terminal but it also not worked
node#node-Lenovo-G550:~/Android/Sdk/platform-tools$ adb kill-server
The program 'adb' is currently not installed. You can install it by typing:
sudo apt-get install android-tools-adb
but I have adb under platform-tools folder, I do not know why its says "not installed", How I can resolve this?. Please help me.
terminal image
Updated question:
I have added path as following:
export PATH=$PATH:/home/node/Android/Sdk/platform-tools
then executed this: ./adb kill-server
it gives me the following error
bash: ./adb: No such file or directory
if I run as adb kill-server it gives bash: /home/node/Android/Sdk/platform-tools/adb: cannot execute binary file: Exec format error
The directory where add is located, is not in your PATH variable. You could add it to your PATH variable (export PATH=$PATH:~/Android/Sdk/platform-tools I believe). You can also use ./adb kill-server. Note the ./ in front of adb. Because you are executing an executable in your current directory, you need ./
I have done the following steps and its works.
first run following comments to install:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot
Second step is move the ADB and Fast boot to our SDK location.
cp /usr/bin/adb <path-to-your-adt-sdk-package>/sdk/platform-tools/adb
cp /usr/bin/fastboot <path-to-your-adt-sdk-package>/sdk/platformtools/fastboot
Last run the command:
SDK location/platform-tools/ adb kill-server.

adb: command not found in Git Bash

I am using Git Bash on Windows 8. Whenever I type
$ adb devices
I get
bash: adb: command not found
I have already added the path to the PATH variable.
if you haven't solved the problem yet, try adding an alias to your adb.exe
place yourself in the git $home folder
cd $home
if you haven't created the .bashrc file yet
Execute
touch .bahsrc
thereupon
vi .bashrc
add the following line to the file
alias adb='/c/adb/platform-tools/adb.exe'
*note: this path is relative, it depends on where you unzipped the .zip from adb
and save the changes made in vi with ESC then :wq!
GitBash is a Terminal-Emulation software using CYGWIN. The ADB command is a Windows binary that is availabe in a Windows Command Prompt via PATH-variable.
Check this question: Git Bash doesn't see my PATH
It's works my windows machine.
Run the following command on your windows bash profile terminal
echo export "PATH=~/AppData/Local/Android/Sdk/platform-tools:$PATH" >> ~/.bash_profile
Restart your Terminal session
source ~/.bash_profile
Go to My Computer-> Right click -> properties
C:\Users\PCNAME\AppData\Local\Android\Sdk\build-tools

bash adb command not found via terminal for OUYA driver setup?

I'm trying to setup the OUYA driver on my Mac OS (Maverick) and I'm getting bash-3.2$ command not found when I type in the commands to root the pointer / install the driver. I'm following this video tutorial http://www.youtube.com/watch?feature=player_embedded&v=5LSBiNfMq8A and have followed everything correctly but for some odd reason once I try to type in adb after bash-3.2$ comes up, not works. What am I doing wrong? I've looked all over the internet and on the OUYA forums and I can't seem to figure out what is wrong with my terminal commands.
Matthews-Mac-mini:~ mycomp$ vi ~/.bashrc
Matthews-Mac-mini:~ mycomp$ adb
-bash: adb: command not found
Matthews-Mac-mini:~ mycomp$ bash
bash-3.2$ adb kill-server
bash: adb: command not found
bash-3.2$
Thanks.
The adb tool is part of the Android SDK. If ANDROID_HOME is set to the directory where you put the Android SDK on your Mac, then you need to add $ANDROID_HOME/platform-tools to PATH , like this in your ~/.bashrc:
ANDROID_HOME=/users/myname/android # or wherever you put the Android SDK
PATH=$ANDROID_HOME/platform-tools:$PATH
For anyone using a Mac that couldn't find were to run the command in the terminal it is located at
Users/YourUserName/Library/Android/sdk/platform-tools
(if you type ls you should see a file called "adb") You'll type ./adb kill-server that should do it.
Apparently the ./ is the full path to the executable.

adb command not found

I need to run an adb forward command before I could use the ezkeyboard application which allows user to type on the phone using browser.
When I run adb forward tcp:8080 tcp:8080 command I get the adb command not found error message.
I can run android command from terminal. Why adb is not working?
In my case with Android Studio 1.1.0 path was this
/Users/<username>/Library/Android/sdk/platform-tools
Add the following to ~/.bash_profile
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
Then run
$ source ~/.bash_profile
to load a profile in a current terminal session, or just reopen a terminal
If you are using more modern Z Shell instead of Bash, put it in ~/.zprofile instead.
Is adb installed? To check, run the following command in Terminal:
~/Library/Android/sdk/platform-tools/adb
If that prints output, skip these following install steps and go straight to the final Terminal command I list:
Launch Android Studio
Launch SDK Manager via Tools -> Android -> SDK Manager
Check Android SDK Platform-Tools
Run the following command on your Mac and restart your Terminal session:
echo export "PATH=~/Library/Android/sdk/platform-tools:$PATH" >> ~/.bash_profile
Note: If you've switched to zsh, the above command should use .zshenv rather than .bash_profile
Make sure adb is in your user's $PATH variable.
or
You can try to locate it with whereis and run it with ./adb
I am using Mac 10.11.1 and using android studio 1.5,
I have my adb
"/Users/user-name/Library/Android/sdk/platform-tools"
Now edit you bash_profile
emacs ~/.bash_profile
Add this line to your bash_profile, and replace the user-name with your username
export PATH="$PATH:/Users/user-name/Library/Android/sdk/platform-tools"
save and close.
Run this command to reload your bash_profile
source ~/.bash_profile
From the file android-sdks/tools/adb_has_moved.txt:
The adb tool has moved to platform-tools/
If you don't see this directory in your SDK, launch the SDK and AVD
Manager (execute the android tool) and install "Android SDK
Platform-tools"
Please also update your PATH environment variable to include the
platform-tools/ directory, so you can execute adb from any location.
so on UNIX do something like:
export PATH=$PATH:~/android-sdks/platform-tools
This is the easiest way and will provide automatic updates.
install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install adb
brew install --cask android-platform-tools
Start using adb
adb devices
Type the below command in terminal:
nano .bash_profile
And add the following lines (replace USERNAME with your own user name).
export ANDROID_HOME=/Users/USERNAME/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
Close the text editor, and then enter the command below:
source .bash_profile
If you don't want to edit PATH variable, go to the platform-tools directory where the SDK is installed, and the command is there.
You can use it like this:
Go to the directory where you placed the SDK:
cd /Users/mansour/Library/Developer/Android/sdk/platform-tools
Type the adb command with ./ to use it from the current directory.
./adb tcpip 5555
./adb devices
./adb connect 192.168.XXX.XXX
For mac users with zshrc file (who don't have bash profile).
Go to your user folder and tap cmd + fn + shift + "." (on Mac laptop keyboard !)
Hidden files are visible, open .zhrc file with a Text Editor
Paste this line, don't forget to change the username between braces :
export PATH="$PATH:/Users/{username}/Library/Android/sdk/platform-tools"
you can save and close the .zhrc
Open terminal and reload the file with this :
source ~/.zshrc
Now you can use adb command lines !
Considering you have already downloaded SDK platform tools. These commands are for MAC users.
This command will set ADB locally. So if you close the terminal and open it again, ADB commands won't work until you run this command again.
export PATH=~/Library/Android/sdk/platform-tools:$PATH
These commands will set ADB globally. So once you run these commands no need to set them again next time.
echo 'export PATH=$PATH:~/Library/Android/sdk/platform-tools/' >> ~/.bash_profile
source ~/.bash_profile
Mac users just open /Users/(USERNAME)/.bash_profile this file in a editor.
and add this line to add path.
export PATH="/Users/myuser/Library/Android/sdk/platform-tools":$PATH
this is the default path if you install adb via studio.
and dont forget to change the username in this line.
You need to install adb first,
the new command (in 2021) is:
brew install --cask android-platform-tools
In my case, I was in the platform-tools directory but was using command in the wrong way:
adb install
instead of the right way:
./adb install
On my Mac (OS X 10.8.5) I have adb here:
~/Library/android-sdk-mac_86/platform-tools
So, edit the $PATH in your .bash_profile and source it.
+ The reason is: you are in the wrong directory (means it doesn't contain adb executor).
+ The solution is (step by step):
1) Find where the adb was installed. Depend on what OS you are using.
Mac, it could be in: "~/Library/Android/sdk/platform-tools"
or
Window, it could be in: "%USERPROFILE%\AppData\Local\Android\sdk\platform-tools\".
However, in case you could NOT remember this such long directory, you can quickly find it by the command "find". Try this in your terminal/ command line, "find / -name "platform-tools" 2> /dev/null" (Note: I didn't test in Window yet, but it works with Mac for sure).
*Explain the find command,
Please note there is a space before the "/" character --> only find in User directory not all the computer.
"2> /dev/null" --> ignore find results denied by permission. Try the one without this code, you will understand what I mean.
2) Go to where we installed adb. There are 3 ways mentioned by many people:
Change the PATH global param (which I won't recommend) by: "export PATH=~/Library/Android/sdk/platform-tools" which is the directory you got from above. Note, this command won't print any result, if you want to make sure you changed PATH successfully, call "export | grep PATH" to see what the PATH is.
Add more definition for the PATH global param (which I recommend) by: "export PATH=~/Library/Android/sdk/platform-tools:$PATH" or "export PATH=$PATH:~/Library/Android/sdk/platform-tools"
Go to the path we found above by "cd ~/Library/Android/sdk/platform-tools"
3) Use adb:
If you change or update the PATH, simply call any adb functions, since you added the PATH as a global param. (e.g: "adb devices")
If you go to the PATH by cd command, call adb functions with pre-fix "./ " (e.g: "./ adb devices")
I solved this issue by install adb package. I'm using Ubuntu.
sudo apt install adb
I think this will help to you.
If you are using a mac, try this below command.
source $HOME/.bash_profile
in my case I added the following line in my terminal:
export PATH="/Users/Username/Library/Android/sdk/platform-tools":$PATH
make sure that you replace "username" with YOUR user name.
hit enter then type 'adb' to see if the error is gone. if it is, this is what you should see:
Android Debug Bridge version 1.0.40
...followed by a bunch of commands..and ending with this:
$ADB_TRACE
comma-separated list of debug info to log:
all,adb,sockets,packets,rwx,usb,sync,sysdeps,transport,jdwp
$ADB_VENDOR_KEYS colon-separated list of keys (files or directories)
$ANDROID_SERIAL serial number to connect to (see -s)
$ANDROID_LOG_TAGS tags to be used by logcat (see logcat --help)
if you get that, run npm run android again and it should work..
To avoid rewriting the $PATH variables every time you start a terminal, edit your .bash_profile (for Macs, it's just .profile) file under your home directory (~/), and place the export statement somewhere in the file.
Now every time you start terminal, your $PATH variable will be correctly updated. To update the terminal environment immediately after modifying the profile file, type in:
source ~/.profile
nano /home/user/.bashrc
export ANDROID_HOME=/psth/to/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
However, this will not work for su/ sudo. If you need to set system-wide variables, you may want to think about adding them to /etc/profile, /etc/bash.bashrc, or /etc/environment.
ie:
nano /etc/bash.bashrc
export ANDROID_HOME=/psth/to/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
This solution is for Mac:
Considering you have already downloaded SDK platform tools & trying to set adb path:
If you want to check the SDK is available or not, just check it by following this path:
User > Library (Hidden folder) > Android > sdk > platform-tools > adb
SDK PATH IMAGE
To set the PATH for the adb command on a macOS system, firstly need to edit your shell configuration file. The default shell on macOS is Bash or Zash.
If you're using Bash, so you will need to edit the ~/.bash_profile file otherwise edit ~/.zprofile in your home directory.
Here's how to do it:
By Terminal:
Open a terminal window and enter the following command:
nano ~/.bash_profile
or
nano ~/.zprofile
This will open the ~/.bash_profile or ~/.zprofile file in the Nano text editor.
Add the following line to the file:
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
Press Ctrl+X to exit the Nano editor, then press Y to save the changes and Enter to confirm the filename.
Run the following command to reload your shell configuration:
source ~/.bash_profile
or
source ~/.zprofile
After you have set the PATH for adb, you should be able to run the adb command from any terminal window.
By Manual:
Go to the Home directory & tap command + shift + . (on Mac system/laptop)
View IMAGE
Search file ~/.bash_profile or ~/.zprofile & open it.
View IMAGE
Add required path & save it.
View IMAGE
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
Run the following command to reload your shell configuration:
source ~/.bash_profile
or
source ~/.zprofile
After you have set the PATH for adb, you should be able to run the adb command from any terminal window.
Make sure you have adb installed
To install it you could run the "sudo apt install adb".
You could also try revoking any USB authorizations on your device and
try connecting with USB debugging enabled.
UNABLE TO LOCATE ADB #SOLVED
Simply Download Sdk platform tools.https://developer.android.com/studio/releases/platform-tools.html
Extract the Downloaded file.
Go to Sdk Manager in Android Studio and copy the link. Go to file Explorer and paste the path for Sdk you copied to view the Sdk files. You will notice that the Adb file is missing, open downloaded file (platform tools) copy contents and replace every content in your Sdk tool file (the file where you noticed adb is missing)and save. You are good to go.
In my case this is the solving of this problem
Make sure you have installed the android SDK. Usually the location of SDK
is located to this location
/Users/your-user/Library/Android/sdk
After that cd to that directory.
Once you are in that directory type this command
./platform-tools/adb install your-location-of apk
if youd dont have adb in folder android-sdk-macosx/platform-tools/ you should install platform tools first. Run android-sdk-macosx/tools/android and Install platform tools from Android SDK manager.
you have to move the adb command to /bin/ folder
in my case:
sudo su
mv /root/Android/Sdk/platform-tools/adb /bin/
If you are using fish:
fish_add_path /Users/<name>/Library/Android/sdk/platform-tools/
Or you can add the same to ~/.config/fish/config.fish
Might need to re start the shell
Add the following command to .zshrc file
Open file in terminal using command -> vi .zshrc
Add the android sdk path - > exportPATH="/Users/<user>/Library/Android/sdk/platform-tools:$PATH"
Close the file by -> Esc + :wq

Android Debug Bridge (adb) command line tool exists in $PATH, but "command not found" in linux

sudo echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/lubuntu/Tools/android-sdk-linux/platform-tools
adb exists in /home/lubuntu/Tools/android-sdk-linux/platform-tools
Then I executed adb start-server:
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Then sudo adb install test.apk
sudo: adb: command not found
I have added adb in the environment variable $PATH, but sudo couldn't find it.
Why?
sudo means you're switching to root, and that does not necessarily mean that your environment comes along. That could be dangerous.
At your risk, add the -E option to inherit the calling environment.
The problem is the PATH var is set for that user, and root don't have the aditional PATH entry, so it can't found the program.
You should setup adb for root too:
adb Environmental Variables
Open ~/.bashrc and add the following to the very bottom
export PATH=${PATH}:<sdk>/tools:<sdk>/platform-tools
Change <sdk> to the actual path. ie /home/user/android-sdk-linux
Close and re-open your terminal to refresh variables.
from adb setup
If doesn't work, make symbolic links from adb and other binaries to /usr/local/bin
Since you are running adb as root in the second example, adb would also have to be on root's path.
completely agree with answer of #unwind.You must not do this using "sudo".Give it a try without sudo and i guess it would work for you.Also, you should add the path to folder named "tools" present in the sdk, though its not connected with your problem, but a suggestion.
Completely agree.
The problem was the Android Debug Bridge (adb) command line tool that was not linked to the path. After setting it in the path, it worked for me.
$ gedit ~/.bashrc
set the path as follows in the .bashrc
export PATH=${PATH}:~/adt-bundle/tools
export PATH=${PATH}:~/adt-bundle/platform-tools

Categories

Resources