cannot kill adb.exe manually - android-studio

After android studio running several hrs,suddenly the connected device shows as offline.And what's annoying is that it always show an offline device no matter connecting or not by usb.
As what we always do, I try to call adb kill-server or adb start-server.From the process list, it shows an new adb.exe was created while the former one wont disappear even i try to stop it from the list.
So far my only solution is restart pc, i mean, FORCE restart.Normal stop or restart will keep my pc in the stopping screen.
Hope someone facing the same issues can support a better solution.Thanks anyway.

Try to update your Android Studio to 2.2. After that you will be able to kill adb.exe if you need.
That helped me fix that bug, but still facing it in 2.1.1.

This is how I deal with my case which happens periodically.
Per the tip of this answer, I find the processes using port 5037 wit command netstat as following:
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\Users\Hong>netstat -a -n -o | find "5037"
TCP 127.0.0.1:5037 0.0.0.0:0 LISTENING 9232
TCP 127.0.0.1:5037 127.0.0.1:52034 ESTABLISHED 9232
TCP 127.0.0.1:52034 127.0.0.1:5037 ESTABLISHED 10824
In the above results, process 9232 is adb.exe and process 10824 is Visual Studio. I can kill adb.exe after closing the other process using port 5037 - Visual Studio

Related

Nox player isn't showing in android studio

I have an AMD A10 processor that doesn't support VT-x. I installed Nox player and enabled USB debugging but still Android studio cannot find the emulator. Any helpful and clear steps to install USB driver adb(Android Debug Bridge)
Connect a NOX device to Android Studio: By Abhijeet Pal
On CMD:
Route: cd C:\Program Files (x86)\Nox\bin
Connection: nox_adb.exe connect 127.0.0.1:62001
Not Connecting Fix
You need to find the correct port and use it. I faced the same problem so here is what I did.
Kill the server:
nox_adb.exe kill-server
Now try to connect on any port number, say, 62001:
C:\Program Files (x86)\Nox\bin>nox_adb.exe connect 127.0.0.1:62001
daemon not running. starting it now on port 5037
daemon started successfully
unable to connect to 127.0.0.1:62001:62001
Now try to use port 5037 as mentioned in the output above:
C:\Program Files (x86)\Nox\bin>nox_adb.exe kill-server
C:\Program Files (x86)\Nox\bin>nox_adb.exe connect 127.0.0.1:5037
daemon not running. starting it now on port 5037
daemon started successfully
connected to 127.0.0.1:5037
It should work fine then.
127.0.0.1:5037 Disconnected on Android Studio Solution
It should appear without any further customizations. I have used Nox Emulator for a while and you have to do a little trick to make it work for debugging:
Click the debug or run button on Android Studio2. Wait for the popup to open (the one where it lists the connected devices)3. Run Nox Emulator4. After Nox is ready and running, it should appear on your connected devices list.
This isn't of my authorship, that's why I attached all sources of problems that I've faced.
I made the mistake of starting the adb server before and then opening android studio. It didn't work.
Subsequently did this:
D:\Program Files\Nox\bin>nox_adb.exe connect 127.0.0.1:62001
adb server version (41) doesn't match this client (36); killing...
* daemon started successfully *
connected to 127.0.0.1:62001
Android studio immediately updated and showed the following:

How to stop Yarn Package Manager script from CLI

https://yarnpkg.com/en/docs/cli/
Is there a way to stop what is started from the command "yarn run"? Is my only option to lookup the process number and call kill on it?
The usual way ctrl-c should work. If it doesn't work, than you have bug in the script. The script's author missed handler for shutdown (SIGINT/SIGTERM/etc).
I had a similar issue having it running after ctl+c and then I thought, maybe it is just running on the cache
so went to http://localhost:3000/
ctrl+F5
which forces refresh without cache showed me that the actual project wasn't really running anymore!
;)
*hadn't it worked I would have had to sudo kill the 3000 port
I know this is a well-answered question. However, it behaved once very strange when I was running a sample React code which was auto-created by the create-react-app CLI, on my Windows 10.
After hitting Ctrl+C, which is the most suggested standard way to stop the yarn run, though I got back the command prompt, there was a ghost process lingering around there, which was still actively listening to 3000(default) port, and localhost:3000 was working as normal.
So finally this is how I fixed it:
netstat -ano | grep ":3000" (yeah, I ran this from my git-bash instead of command prompt!)
Noted down the PID of the line where it says LISTENING on 3000
Pressed Ctrl+Shift+Esc to open the Task Manager
Went to the Process tab
Right clicked on one of the headings, say Name
Selected PID --> This added the PID column to the display
Located the PID in question
Right clicked on it and clicked "End task"
Luckily Windows knew how to kill that misbehaving, ghost process and the port became free for me.
NOTE: Prior to the above-mentioned steps, I tried to kill that PID from git-bash using the famous (or notorious as per its meaning?? >8)) kill -9 command. It was responding back with no such PID msg, however netstat -ano was clearly displaying the PID and browser was proving that the ghost process is up and alive!!

Connecting to Localhost on Mac from Another Mac: Websocket Issues?

I have a node.js web app running on http://localhost:3000/ on my iMac. I am able to log on to that web app from Chrome on my MacBook using the Wi-Fi IP address of my iMac (found in System Preferences->Network) and the port my web app is running on:
http://10.0.0.37:3000
When using this technique, is there any reason why a websocket would fail in calling a service on a distant server?
Thanks in advance to any thoughts!
It turns out nothing was wrong with websockets. The camera on my MacBook was deactivated for some reason, and that was causing errors from the service I was accessing. I was able to reactivate the camera using instructions from this page:
Quit all apps that you are trying to use with the Camera > Open
Terminal (find in /Applications/Utilities) > copy and paste the
following command then hit the Enter key > Type administrator password
hit Enter.
sudo killall VDCAssistant
if still at the terminal, issue the following command:
sudo killall AppleCameraAssistant

The latest ndk-gdb can not connect to my device

I just get trouble to use ndk-gdb to debug my native application. This is my environment:
OS X El Captain 10.11.5
NDK version r12
SDK version 24
Build tool version 24.0.0
Device Nexus 6P with Android N (NPD35K)
The issue:
When I was going to launch ndk-gdb it always fail with the message
Error: unable to connect to device.
Remote connection closed
However, the gdbserver instance has already been launched since my app is paused and I could see the gdbserver in adb shell ps list.
What I have tried:
Instead of start gdbserver by the ndk-gdb script, I launched the
gdbserver manually by adb run-as and make sure the gdbserver
keeps running
Make a socket forward by adb forward :5039 localfilesystem:/the_gdb_socket_path
Use netstat -na | grep 5309 to make sure the port is being listening
Use telnet localhost 5039 to test socket but get the error Connection closed by foreign host
Is there any better way to identify where the issue cause the remote gdb failed on connection?
In my case, I had to root the phone to fix that connection issue, see:
Does ndk-gdb work under macOS Sierra?

Azure Storage Emulator error and does not start

This error is really driving me crazy. (Terminal running in administrator mode)
Initialization of azure storage emulator in sql server 2014:
C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator>.\wastorage
emulator init -server MY-PC
Windows Azure Storage Emulator 3.0.0.0 command line tool
The storage emulator was successfully initialized and is ready to use.
Error when starting server:
C:\Program Files (x86)\Microsoft SDKs\Windows Azure\Storage Emulator>.\wastorage
emulator start
Windows Azure Storage Emulator 3.0.0.0 command line tool
Unhandled Exception: System.TimeoutException: Unable to open wait handle.
at Microsoft.WindowsAzure.Storage.Emulator.Controller.EmulatorProcessControll
er.InternalWaitForStorageEmulator(Int32 timeoutInMilliseconds)
at Microsoft.WindowsAzure.Storage.Emulator.Controller.EmulatorProcessControll
er.EnsureRunning(Int32 timeoutInMilliseconds)
at Microsoft.WindowsAzure.Storage.Emulator.StartCommand.RunCommand()
at Microsoft.WindowsAzure.Storage.Emulator.Program.Main(String[] args)
Check if you are running BitTorrent/uTorrent or similar software using port 10000.
Check Steve Marx' blog post about the issue. http://blog.smarx.com/posts/windows-azure-storage-emulator-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process
In case that post disappears, the command to check if any other software is using that port is:
C:\Users\smarx>netstat -p tcp -ano | findstr :10000
TCP 127.0.0.1:10000 0.0.0.0:0 LISTENING 3672
Summarizing and adding additional points to other answers to this question.
Open C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe file in a notepad or a notepad++ editor.
Look at the services section.
<services>
<service name="Blob" url="http://127.0.0.1:10000/"/>
<service name="Queue" url="http://127.0.0.1:10001/"/>
<service name="Table" url="http://127.0.0.1:10002/"/>
</services>
Try to open URL for "Blob" in a web browser.
In my case it is
http://127.0.0.1:10000/
If you are unable to open the URL or if there is a error, this is the reason why you are not unable to start Azure Storage Emulator.
Try below steps to resolve the issue.
1) Check if the port 10000 is busy or used by any other process.
To know this you can type the below command in the command prompt
netstat -na | find "10000"
Kill the process.
Now start the Azure Storage Emulator in -inprocess mode
In the Azure Storage Emulator's command prompt type
AzureStorageEmulator.exe start -inprocess
Ctrl+c and then
AzureStorageEmulator.exe start
If this did not resolve the issue try second step.
2) Run this
netsh http add iplisten 127.0.0.1
and then in the Azure Storage Emulator's command prompt type
AzureStorageEmulator.exe start -inprocess
Ctrl+c and then
AzureStorageEmulator.exe start
I have same issue after Azure tools update (2.3 version). After hours of research I found strange solution - set 'Start Windows Azure storage emulator' to 'False' (in properties of Azure project).
The issue maybe port 10000 is being occupied. Storage emulator runs on port 10000. So you need to kill that process. On windows, open cmd as admin and run following commands.
First find the process occupying port 10000
netstat -ano | findstr :10000
kill the process
taskkill /PID <process id> /F
Now try starting emulator again.
In the file C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config
you need to change port numbers:
Make sure the user that initialized the emulator is the same as the user that is starting the emulator. Note that if you elevate as a different user to run initialization, then the initialization only applies to that user.
If that doesn't help, you can try to launch the emulator with the -inprocess flag to get a more detailed error message:
WAStorageEmulator start -inprocess
Run Microsoft Azure Command Prompt as administrator and try to first initialize using AzureStorageEmulator.exe init and then start using AzureStorageEmulator.exe start commands. It worked for my case.
I had same issue since I had to rejoin my machine to the domain and the user profile got recreated.
I noticed that it was starting with option -inprocess from elevated cmd.
Then I realized that it has to do with urlac and I solved deleting old ones with following commands:
(from elevated cmd)
netsh http delete urlacl url=http://127.0.0.1:10000/
netsh http delete urlacl url=http://127.0.0.1:10001/
netsh http delete urlacl url=http://127.0.0.1:10002/
After that simply start as usual, the tool will recreate what necessary.
Now I can use it without elevation.
It is also worth to try to run the command prompt with: "Run As Administrator"
and then run the command:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe start
That did the trick for me!
Another option is to change the ip binding that the emulator uses in the config file located in the storage emulator directory.
Find wastorageemulator.exe.config
and change
<services>
<service name="Blob" url="http://127.0.0.1:10000/"/>
<service name="Queue" url="http://127.0.0.1:10001/"/>
<service name="Table" url="http://127.0.0.1:10002/"/>
</services>
This would be usefull if another application is already using that port and you cannot uninstall.
if you are trying to start "Azure storage emulator" through Visual Studio=>Server explorer, make sure that you are starting visual studio as an administrator.
I was able to get this issue fixed by running the "Azure storage emulator" on the command prompt, by running the command prompt as an administrator.
open command prompt as administrator
run command: cd C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator
run command: AzureStorageEmulator start
There is some info here that might help:
AzureStorageEmulator.exe init –server MyMachine –sqlinstance **.** –forcecreate –inprocess
See this link.
I just hit this, and it turns out that Microsoft Teams was using port 10000. Forcing teams to quit resolved the issue. 🤷
For me there was nothing running on the needed ports, the issue was that Visual Studio was not started in Administrator mode so the process couldn't be started.
When I went to the Azure Storage Emulator CLI from "Start" that launches a command shell that is also not in Administrator mode which obviously produces the same result.
Opening a command shell in Admin mode did the job.
Windows Backup Agent was running on my VM box on port 10000 - moving to 10003 (via the .exe.config file worked)
First you should initialize the emulator database and configuration be starting
AzureStorageEmulator.exe as administrator with a key init:
AzureStorageEmulator.exe init
Then, if you still receive an error:
Service Status: Blob http://127.0.0.1:10000/ False
The process cannot access the file because it is being used by another process
Error: Unable to start the storage emulator.
try to change 127.0.0.1 to localhost for all services in
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe.config
It worked for me:
Press the Windows key and search "Azure Storage Emulator"
It shows me an error message "..Cannot create the database "AzureStorageEmulatorDb510"
I opened the SSMS and looked for that database but I found "AzureStorageEmulatorDb59"
I renamed the database to "AzureStorageEmulatorDb510"
Try again run "Azure Storage Emulator"
The reason for me was Hyper-V. It reserves a lot of ports. You can check reserved ports netsh int ip show excludedportrange protocol=tcp. Easiest solution - change ports in config file.
I had the same problem, I tried many ways, nothing was blocking port 10000. I tried updating the emulator config to Localhost instead of 127.0.0.1 here
<services>
<service name="Blob" url="http://127.0.0.1:10000/"/>
<service name="Queue" url="http://127.0.0.1:10001/"/>
<service name="Table" url="http://127.0.0.1:10002/"/>
</services>
but I had the timeout issue again.
Finally, I had to uninstall my IIS. and problem solved. there should be a way to make them work together.
I have had this happen recently, and it was because I'd recently installed the HDInsight emulator. It appears this was auto-starting the storage emulator causing an error when VS attempted to start it resulting in an error.
Setting the "Start Microsoft Azure storage emulator" value to False worked in this case also.
I encountered the same problem. I found out that, the port 10000 is being used by another process. In my case, utorrent was using it. It could be Bittorrent if that's what you are using. After uninstalling it, it started smoothly with altering my data.
If your torrent downloader means so much to you, you can consider solving your issue from that angle. I hope this works.
For users of the newly released documentdb emulator...Microsoft thought it is a good idea that the documentdb emulator uses the same port as the Storage emulator ;) The only way you can access your storage is by shutting down documentdb emulator and restart Visual Studio and voila you can use it again :facepalm:
I got similar issue with visual studio while trying to run Azure Functions. AzureStorageEmulator.exe init worked for me
I experienced a power outage and after rebooting received the Unhandled Exception: System.TimeoutException message attempting to launch and debug an Azure Functions project from Visual Studio 2019. I tried many (if not all) of the other suggested answers on this thread to no avail. Including but not necessarily limited to ...
Checking for processes using ports 10000-10002, (none were)
Running Visual Studio and/or AzureStorageEmulator as administrator
Deleting / recreating the storage database
Attempted netsh http add iplisten 127.0.0.1 etc. from #Ram Pratap's answer
Changed hostname and port number bindings
Tried AzureStorageEmulator init and AzureStoreEmulator start -inprocess
What finally worked for me was ...
Installing the Storage Emulator using the standalone installer
This then allowed me to fully uninstall just the Storage Emulator using Add & Remove Programs, followed by a restart.
Next I reinstalled the Storage Emulator using the standalone installer, followed by a restart.
Finally I ran AzureStorageEmulator start it worked!
Had the same issue, deleting the AzureStorageEmulatorDb510* files in my user folder(C:\Users{UserName}) and running C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator>AzureStorageEmulator.exe init /forceCreate solved it for me. I was then able to start with AzureStorageEmulator.exe start.
Also ran the Cmd.exe in administrator mode.
Had the same issue, node.exe is usually the one using port 127.0.0.1:1000 to 10003, which are used for StorageEmulator as well. so easy solution to try is, kill the node process from task manager,
Also test by stopping the IIS (if on windows) and test if everything works fine.
In my case AzureStorageEmulator.exe was throwing this error because i updated my VS 2022 and it installed azurite with it which was holding the port :10000.
I solved this by ending the task in Task Manager
As pointed out by Dale Francis in one of the comments of top answer
IDK but none of the solutions work for me. Then accidently I noticed an icon in my taskbar hidden items. It was showing me that my computer emulator is shutdown. Once I start the emulator by following the shown steps it is working fine.

Resources