I get the following errors when I try to run my Android program.
Please explain me What really adb is, and how to restart it?
I am getting the following error
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
adb is Android Debug Bridge.
To restart adb by command line:
adb kill-server
adb start-server
To restart adb in Eclipse:
Window > Show View > Other... > Android/Devices
When the view is showing: View Menu of "Devices" > Reset adb
Android Debug Bridge
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:
A client, which runs on your development machine. You can invoke a
client from a shell by issuing an adb command. Other Android tools
such as the ADT plugin and DDMS also create adb clients.
A server, which runs as a background process on your development
machine. The server manages communication between the client and the
adb daemon running on an emulator or device.
A daemon, which runs as a background process on each emulator or
device instance.
Restarting ADB
adb kill-server && adb start-server
By using above command, that'll restart the adb server. And, if you're using Eclipse means, please see the below image -
In your DDMS one option is there for restarting the adb like in above image. Hope this helps you.
ADB stands for Android Debug Bridge.
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.
In depth details can be found here.
As for restarting adb server you can execute following commands
adb kill-server
adb start-server
As for Eclipse simply close the IDE and restart/reopen. Infact restarting Eclipse should restart adb server as well.
PS: Above link goes to my personal blog that has additional details on ADB.
I saw this problem on Eclipse, and it reported that I needed to 'reset adb from the Device's view'. The adb kill&restart-server sequence didn't work for me, but I was successful with just disabling and then re-enabling the 'USB debugging' check box in the phone's Settings->Developer Options
i also came across with this problem, i got this error please ensure that adb is correctly located “Users/semihozkoroglu/ADT/sdk/platform-tools/adb” and can be executed
Click devices dropdown - > reset adb, its works..
ADB is a Android Debug Bridge.
Following for more Details ADB
http://www.addictivetips.com/mobile/what-is-adb-and-how-to-install-it-android/
http://developer.android.com/guide/developing/tools/adb.html
Close And Open Eclipse,Adb is automatically restarted..!
Thanks..!
Related
Background:
I recently upgraded to an AMD processor and found that the Android device emulator was complaining about not having hardware acceleration. (This is an issue for another question). My old Intel computer worked fine, so I decided to run the emulator on the old Intel PC (emu-pc) and use my new AMD computer (dev-pc) to code.
Problem:
I wasn't able to directly have the emulator expose its ports on the emu-pc to connect to via adb on the dev-pc (again an issue for another question), so I installed the Windows 10 OpenSSH server (Microsoft instructions) and connected to it from my dev-pc, forwarding the proper ADB ports:
ssh {you}#<{remote ip} -L 5554:localhost:5554 -L 5555:localhost:5555
I then tried connecting to the remote emulator via adb:
adb connect localhost
I was met with
$ ./adb devices
List of devices attached
localhost:5555 unauthorized
I've tried a few of the posts stating you should disable and re-enable USB debugging or revoke all the USB debugging authorization or use the "Wipe Data" option in the AVD Manager. None of these worked. I also tried messing with the adbkeys on the emulator under /data/misc/adb/adbkeys but I get permission denied trying to do anything to that file. (I also can't ls it via an adb shell)
Any ideas?
I found something that worked for me. I was able to telnet to the emu-pc via port 5554, where I tried to auth on the Android console. The login message said:
Android Console: type 'auth <auth_token>' to authenticate
Android Console: you can find your <auth_token> in
'C:\Users\exile57\.emulator_console_auth_token'
I found that file and was able to log in. This made me think that the emulator thinks the connection is coming from the emu-pc, yet the keys that I was using were generated on the dev-pc. I found the keys on emu-pc in C:\Users\[your user]\.android as adbkey and adbkey.pub. I copied those to the dev-pc, killed the adb server, disconnected all devices, then tried reconnecting:
$ ./adb disconnect
./adb kill-server
./adb connect localhost
After a bit, I was able to connect and drive the device over adb:
$ ./adb devices
List of devices attached
localhost:5555 device
NOTE I'm not sure this is the whole story, as when testing this out for this answer, I deleted the dev-pc's adbkey and adbkey,pub and was still able to reconnect, so that seems a bit strange. It worked for me, but be aware, I'm not sure the mechanism.
In Android studio, Run menu > Run shows OFFLINE ... for the connected device.
Below is the procedure followed to solve it:
(Read the below note first) Delete the ~/.android/adbkey (or, rename to ~/.android/adbkey2, this is even better incase you want it back for some reason)
Note: I happened to do this step, but it didn't solve the problem, after doing all the below steps it worked, so unsure if this step is required.
Run locate platform-tools/adb
Note: use the path that comes from here in below commands
Kill adb server:
sudo ~/Android/Sdk/platform-tools/adb kill-server
You will get a Allow accept.. message popup on your device. Accept it. This is important, which solves the problem.
Start adb server:
sudo ~/Android/Sdk/platform-tools/adb start-server
In Android studio, do Run menu > Run again
It will show something like Samsung ... (your phone manufacture name).
Also installs the apk on device correctly this time without error.
Hope that helps.
Here is how I did it:
First you need to run the emulator on the host computer. I used Android Studio and I had to close it because I noticed that the adb process kept spawning.
Start port-forwarding using SSH in the development computer.
ssh -L 5554:localhost:5554 -L 5555:localhost:5555 user#emulator-host-ip
copy adbkey and adbkey.pub files found at: C:\Users\[your user]\.android from the host computer to the development computer. this step should get ride of the unauthorized problem
in the development computer kill the adb server and lookup connected devices:
$ ./adb kill-server
$ ./adb devices
List of devices attached
localhost:5555 device
When I open Android Studio, it shows the dialog below, and my application can't run as debug mode.
Find the folder of sdk->platform-tool then run the command adb tcpip 5555.
This should result in the following:
Now restart Android Studio and reconnect the Android Monitor:
Stop adb from terminal by calling adb kill-server repeatedly to kill all running unstances of adb.
Disable adb integration at android Studio by unmarking “Enable ADB Integration” (from toolbar -> Tools -> Android -> Enable ADB Integration).
Enable ADB Integration again by marking “Enable ADB Integration”.
Finally run project, so adb will be started automatically and properly.
It looks like Android Studio 3.2 uses DNS to resolve "localhost" on OSX (that seems like a bad idea, Google), and in my case a bad DNS entry on the local DNS server broke things.
nmr2:notes nathan$ hostname
nmr2
nmr2:notes nathan$ host nmr2
nmr2.mycompany.co has address 192.168.0.31
nmr2:notes nathan$ host localhost
localhost.mycompany.co has address 192.168.0.85
nmr2:notes nathan$ sudo grep -rni 192.168.0.85 /etc
So, verify that localhost resolves to 127.0.0.1
During learning Android in Android Studio, I click on Window->Reset Perspective in android device monitor.
After that it gives me this error.
My android virtual device is running successfully.
Help me solve this issue.
Few solutions i tried and which worked for me in different times :
Go in devices view, delete the device and create a new one.
Kill the adb through command line
Before you execute the commands in CMD make sure that you added the adb tool to your Environment Variables path.
Killing adb
adb kill-server
Starting adb
adb start-server
other way of killing adb is Go to task manager->processes and kill the adb.exe process.
Even after doing all these if it prevails, the final thing i did is restarted my whole machine so that adb process is removed from RAM.
Hope it helped :)
I previously developped Android apps on Android Studio . Everything works fine.
I work on real device, and Android Studio recognize it without issue.
Suddenly when I exit android studio and disconnect and reconnect my device, it doesn't recognize my device anymore, I have to exit and restart Android Studio.
I can't find a way to "Reset adb" like Android Studio.
I follow the below instruction(Tools->Android->Enable ADB Integration) and enabled ADB,but still below error occurred.
Error:-
I using windows system.
Any help great appreciation.
Open Command prompt and go to
android sdk>platform-tools>
adb kill-server
press enter
and again
adb start-server
press enter
open command prompt -> cd to your sdk\platform-tools
type below command:
adb kill-server && adb start-server
open cmd and type the following command
netstat -aon|findstr 5037
and press enter.
you will get a reply like this :
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 3372
TCP 127.0.0.1:5037 127.0.0.1:50126 TIME_WAIT 0
TCP 127.0.0.1:5037 127.0.0.1:50127 TIME_WAIT 0
TCP 127.0.0.1:50127 127.0.0.1:5037 TIME_WAIT 0
this shows the pid which is occupying the adb. in this 3372 is the value. it will not be same for anyone. so you need to do this every time you face this problem.
now type this :
taskkill /pid 3372(the pid you get in the previous step) /f
Voila! now adb runs perfectly.
Open a Task Manager by pressing CTRL+ALT+DELETE, or right click at the bottom of the start menu and select Start Task Manager. see how to launch the task manager here
Click on Processes or depending on OS, Details. Judging by your screenshot it's Processes.
Look for adb.exe from that list, click on END PROCESS
Click on the restart button in that window above. That should do it.
Basically by suddenly removing your device ADB got confused and won't respond while waiting for a device, and Android Studio doesn't want multiple instances of an ADB server running, so you'll have to kill the previous server manually and restart the whole process.
Most of the answer is for restarting adb server in the command line.
Jiří's answer is the correct answer for this question (to restart adb server IN ANDROID STUDIO), though it's been redesign as shown below.
go to Tools > Troubleshoot Device Connections
ps. you need to hit "Next" two times to find this Restart ADB server button.
Android Device Monitor was deprecated in Android Studio 3.1 and removed from Android Studio 3.2.
I do not find a perfect way in Android Studio, get the process id and kill it from terminal:
ps -e | grep adb
kill -9 pid_adb
Open task manager and kill adb.exe, now adb will start normally
I faced same issue just fallowed some min steps in Android studio:
Manually fallowing steps in android studio
Goto Command promt and in Command promt fallow a android SDK file path "android sdk>platform-tools>" adb kill-server press enter
adb start-server press enter
-------------------------------------------------OR-----------------------------------------------------------------------
Open Command promt and got android sdk file path
adb kill-server && adb start-server
If you are in Android Studio Open Terminal
adb kill-server
press enter
and again
adb start-server
press enter
Otherwise
Open Command prompt and got android
sdk>platform-tools> adb kill-server
press enter
and again
adb start-server
press enter
AndroidStudio:
Go to: Tools -> Android -> Android Device Monitor
see the Device tab, under many icons, last one is drop-down arrow.
Open it.
At the bottom: RESET ADB.
After reinstalling Android Studio, Is working without adb kill-server
Make sure you have "USB debugging" turns on.
I never had this issue with my other devices before. However, today I worked on a device and encountered this issue. Actually took me a while to debug it. Always thought "USB debugging" is on automatically when turning on the "Developer Options". But turns out its device dependent.
Restart adb
Android Studio uses Android Debug Bridge (adb) inside
adb kill-server
adb start-server
e.g.
alex#yoAlex5$ adb kill-server
alex#yoAlex5$ adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully
A possible solution to your problem could be the following:
Go to ~.android\avd{your_device}.avd
Delete all files with .lock extention
I'm facing this problem since i have installed another adb server for another software.
So if you are a linux user simply open terminal and type:
killall adb
When I had this problem, I wrote adb kill-server and adb restart-server in terminal, but the problem appeared again the next day. Then I updated GPU debugging tools in the Android SDK manager and restarted the computer, which worked for me.
I keep reading tutorials where I'm supposed to enter something into the ADB command line and that it's in my Android sdk/platform-tools. So I find it, click on it, and a black screen comes up for about 2 seconds and while it's up, it scrolls through a bunch of text. So how am I supposed to use this "adb"?
It is called the Android Debug Bridge, and the Android Developers Site documentation does a better job of explaining it than I can:
http://developer.android.com/guide/developing/tools/adb.html
If you are looking for the adb command line, navigate to <sdk>/platform-tools/ and run
adb.exe shell
from the command line.
Pretty sure that is well documented since day 1 on the Android Debug Bridge
Android Debug Bridge (adb) is a versatile command line tool that lets
you communicate with an emulator instance or connected Android-powered
device. It is a client-server program that includes three components:
A client, which runs on your development machine. You can invoke a
client from a shell by issuing an adb command. Other Android tools
such as the ADT plugin and DDMS also create adb clients. A server,
which runs as a background process on your development machine. The
server manages communication between the client and the adb daemon
running on an emulator or device. A daemon, which runs as a background
process on each emulator or device instance.
So plain old English, ADB can be found on %ANDROID_HOME%/platform-toos/, and it's this magical command line that allows you to comunicate with your mobile device, either a physical or a Virtual device (AVD), so whenever you deploy you are passing the application through the device thanks to the ADB on a specific client port on your computer to the daemon port on the device.
Interesting things you can do with it?
Logcat: ./adb logcat allows you to see the log trace of each proces.
Install: ./adb install allows you to install apk to the device.
Killing:./adb kill-sever
Starting:./adb stat-server
Enter SQLite3: adb -s your_device shell
Use the monkey: adb shell monkey -v -p your.app.package 500 to
generate random events
And a lot more! Read the documentation it's beatiful and self-explanatory.