Android Studio : adb unable to connect to local host 5037 CreateFileW nul system cannot file specified - android-studio

I know this is an duplicate question and believe me I have read every thread there is on this post
1) adb: CreateFileW 'null' failed: The system cannot find the specified file
2) Daemon not running. starting it now on port 5037 * Cannot open 'nul': The system cannot find the file specified
3) ddms: 'adb.exe,start-server' failed — run manually if necessary, Android Studio
I have tried EVERYTHING!!!
a)Uninstalling android studio,its emulators,sdk and deleting every folder saying android in my system
from C:/Users/${HOME}/AddData/Local & Roaming to even C:/Windows/[All System Folders(No adb was found in these folders)},Program Data etc.
b)Uninstalling and Reinstalling Platform Tools from Tools->SDK Manager->SDK Tools after android studio reinstallation
c)Manually going to ${ANDROID_SDK_HOME}/platform-tools folder, opening cmd as administrator and running
->adb start-server[Gives Same Error As Above]
->adb kill-server[Unable to connect to target machine ip xxx.xx.xx connection actively refused]
->adb start-server[Same Error As My Question]
d)Tried to verify if any apps running on port 5037
netstat -aon | findstr 5037
nothing
My specs are[No new updates are available for any of the below specifications]
1)Android Studio 3.5.1
2)Platform Tools 29.0.4
3)gradle 5.4.1
4)Windows 10 64 bit
Also i have geny motion installed but with no adb the emulator is not recognized in the device list
I know this issue was posted atleast an year back but i hope some new light has been shed on the issue
plzz help thank u in advanced

Related

VS Code SSH Remote Connection issues

I have been using VS Code and connecting remotely from home on my MacBookPro to work on a college project for the past month and for some reason it will not connect to the Computer Lab Server anymore. No idea why this is happening but it just stopped working today. I tried re-installing vs code and also installed it on my wife's computer but it still wont connect through remote ssh. No idea why this is happening but now I have no way to debug my code and have to just edit everything using emacs through the terminal app on my mac. I didn't make any changes from last night to this morning.. I can still ssh into the Computer Lab server from terminal fine. Bellow is some of the log that seems to repeat itself while it is trying to connect using the extension: remote ssh.
Any help on this would be greatly appreciated, or are there other IDE's that are somewhat easy to connect remotely through ssh available for Mac?
MY LOG:
17:09:21.150] Log Level: 2
[17:09:21.152] remote-ssh#0.55.0
[17:09:21.152] darwin x64
[17:09:21.153] SSH Resolver called for "ssh- remote+7b22686f73744e616d65223a226c696e75782e63732e75736d2e6d61696e652e656475222c2275736572223a22746b7766c6b227d", attempt 1
[17:09:21.154] SSH Resolver called for host: tkwilk#linux.cs.usm.maine.edu
[17:09:21.154] Setting up SSH remote "linux.cs.usm.maine.edu"
[17:09:21.158] Acquiring local install lock: /var/folders/9y/scfwvr0577qfgs_l_c5ym13m0000gq/T/vscode-remote-ssh-tkwilk#linux.cs.usm.maine.edu-install.lock
[17:09:21.192] Looking for existing server data file at /Users/twilk31888 1/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-tkwilk#linux.cs.usm.maine.edu-93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3-0.55.0/data.json
[17:09:21.194] Using commit id "93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3" and quality "stable" for server
[17:09:21.195] Install and start server if needed
[17:09:21.220] Checking ssh with "ssh -V"
[17:09:21.233] > OpenSSH_8.1p1, LibreSSL 2.7.3
[17:09:21.249] askpass server listening on /var/folders/9y/scfwvr0577qfgs_l_c5ym13m0000gq/T/vscode-ssh-askpass-a45a56dcf061823c964fa6ae7ff720ac39d2477f.sock
[17:09:21.249] Spawning local server with {"ipcHandlePath":"/var/folders/9y/scfwvr0577qfgs_l_c5ym13m0000gq/T/vscode-ssh-askpass-c1cf58194111018972f9cf0cd413a94b7293bda9.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","54601","-o","ConnectTimeout=15","tkwilk#linux.cs.usm.maine.edu"],"dataFilePath":"/Users/twilk31888 1/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-tkwilk#linux.cs.usm.maine.edu-93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3-0.55.0/data.json"}
[17:09:21.249] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/twilk31888 1/.vscode/extensions/ms-vscode-remote.remote-ssh-0.55.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer)","VSCODE_SSH_ASKPASS_MAIN":"/Users/twilk31888 1/.vscode/extensions/ms-vscode-remote.remote-ssh-0.55.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/9y/scfwvr0577qfgs_l_c5ym13m0000gq/T/vscode-ssh-askpass-a45a56dcf061823c964fa6ae7ff720ac39d2477f.sock"}
[17:09:21.262] Spawned 4239
[17:09:21.373] > local-server> Spawned ssh: 4240
[17:09:21.379] stderr> OpenSSH_8.1p1, LibreSSL 2.7.3
[17:09:21.756] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:wny4SU/uVC6y9cUUH5kJnRe5SVWpBhWGABpWSYzMNG0
[17:09:22.132] stderr> Authenticated to linux.cs.usm.maine.edu ([130.111.131.121]:22).
[17:09:22.490] > ready: 946b80caa0f2
[17:09:22.553] > Linux 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020
[17:09:22.554] Platform: linux
[17:09:22.685] > 946b80caa0f2: running
[17:09:22.713] > Acquiring lock on /home/students/tkwilk/.vscode-server/bin/93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3/vscode-remote-lock.tkwilk.93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
> Installation already in progress...
> 946b80caa0f2##24##
[17:09:22.714] Received install output: 946b80caa0f2##24##
[17:09:22.714] Server installation process already in progress - waiting and retrying
[17:09:22.714] Terminating local server
[17:09:22.740] Local server exit: 15
The key info is provided at the line
[17:09:22.713] > Acquiring lock on /home/students/tkwilk/.vscode-server/bin/93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3/vscode-remote-lock.tkwilk.93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
If you could ssh into the server and remove the file by
rm -rf /home/students/tkwilk/.vscode-server/bin/93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3/vscode-remote-lock.tkwilk.93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3
then reboot the vscode and try to connect, things should be fine.
Encountered the same problem on two servers with two different causes:
One problem is solved by referring to this issue: #2805
Command Palette -> Select "Remote-SSH: Kill VS Code Server on Host..."
Remove the directory of "~/.vscode-server" on remote server.
The other problems, is caused by running out of storage quota on that server. And the issue was automatically solved when the quota was increased.
Most of the microsoft/vscode-remote-release I see, like issue 2901, are about a failed symlink on the target server.
If you can ssh in command line, try and rename /home/students/tkwilk/.vscode-server in order to force a complete re-installation of the SSH remote plugin by VSCode.
mv ~/.vscode-server ~/.vscode-server-old
Try and connect to that server through VSCode and see if the issue persists, when it tries to redo the complete vscode-server SSH setup.
I found a new reason, but it may be rare:
Before I found this problem, I had updated and modified the linux kernel of the remote virtual machine, and modified the UTS_SYSNAME located in /include/linux/uts.h;
#define UTS_SYSNAME "Linux Clstilmldy-LZM"
// #define UTS_SYSNAME "Linux"
So I met this problem, but I never found a feasible solution;
I carefully looked at the vscode output and found that vscode remote ssh: Unsupported platform: Linux Clstilmldy LZM;
[16:38:25.333] SSH Resolver called for host: Ubuntu
[16:38:25.334] Setting up SSH remote "Ubuntu"
...
[16:38:35.555] Got password response
[16:38:35.555] "install" wrote data to terminal: "******"
[16:38:35.574] >
[16:38:36.069] > ac25402ecd5f: running
[16:38:36.086] > Unsupported platform: Linux Clstilmldy-LZM
[16:38:36.096] > ac25402ecd5f: start
I guess that vscode remote ssh does not recognize system names other than Linux, Mac, and Windows, so I changed this line back.
I recompile and install the kernel.
okkk, I solve the problem.
Another answer, since none of these worked for me. Try toggling off the following setting in VSCode: remote.SSH.useFlock

Emulator is not detected automatically unable to connect to device

I have a Dell device and suddenly I cannot connect the Android studio to the emulator. I get the following error message:
unable to open connection to: localhost/127.0.0.1:5037, due to:
java.net.connectexception: connection refused: connect
Any Idea how to fix it ?
Try Manually Starting the Server.
Location to your ADB.exe Android\Sdk\platform-tools\adb.exe start-server
I had the same problem after some unknown operations with my Windows 10. I tried many different ways, and finally solved it with the following steps:
open Command Prompt with Adminstrator privilege. (If you don't know how to, please google.)
"netstat -ao" to find which process takes the port of 127.0.0.1:5037. FOr example, something like
TCP 127.0.0.1:5037 mypcname:0 LISTENING 15752
Here the culprit PID is 15752.
"taskkill /PID /F PID" to kill the process. Replace PID with your number, e.g., 15752.
retry adb. If it works, you may sometimes have to proceed with the following steps.
If it is a Windows service that is using the port, it may start automatically, and blocks adb subsequently. You could specify another adb server port for environment variable ANDROID_ADB_SERVER_PORT.
If the Windows service is LogsAndAlerts (which is the common case for many), you can disable or delete it with:
sc config "LogsAndAlerts" start= disabled
sc delete "LogsAndAlerts"
Download this and extract it to in my case
C:\Users\Dev\AppData\Local\Android\Sdk\platform-tools.
It worked for me.

Android emulator: wifi connected, no internet

It's been a while since I opened android studio. It's all good until today.
Today the android emulator can't connect to the internet (tried with chrome browser and my application in the emulator), altough it's wifi is connected.
How to fix this?
I already tried:
your_path_of_android_sdk\tools\emulator -avd -dns-server 8.8.8.8, but failed with message: PANIC: Missing emulator engine program for 'x86'
remove emulator, and add a new one from AVD manager
restart pc
reinstall android studio
emulator wifi settings (auto ip / dhcp):
Nexus 5S Api 28
ip address: 192.168.232.2
gateway: 192.168.232.1
subnetmask: 255.255.248.0
dns: 10.0.2.3
Is there a possibility I accidentally uninstall something important / removing network adapter in the 'Control Panel\Network and Internet\Network Connections' ?
( there is only one adapter in there )
Images:
wifi connected, no internet
emulator wifi settings
network adapter on win 7
Just found the solution
your_path_of_android_sdk\tools\emulator -avd -dns-server 8.8.8.8, but failed with message: PANIC: Missing emulator engine program for 'x86'
it does work! but i have to use emulator.exe in the "emulator" folder, not the one in the "tools" folder
the complete command is:
F:\AndroidSDK\emulator>emulator -avd Nexus_5X_API_28_x86 -dns-server 8.8.8.8
where Nexus_5X_API_28_x86 is my android emulator name (found in the avd manager in the android studio).
I was facing the same problem. So while using emulator in outside network it was working and then at my home network, same emulator was showing no internet. The possible cause is due to DNS.
But the solution I opted for this issue is to start emulator, turn off Wi-Fi and turn off data connection of emulator. And then turn on both again and see it will get connected to Internet eventually.

How to run sdkmanager behind a proxy?

At my workplace, we have a corporate proxy that signs every incoming connections and we need to authenticate to be able to connect to Internet. I've configured the proxy in way too many places, and I got most software to use it. Now, the only program left (for now) that disrespect my config is sdkmanager. So, how do I make sdkmanager respect my proxy/authentication/certificate config?
sdkmanager
Warning: File /home/users/n.gendron/.android/repositories.cfg could not be loaded.
Warning: java.net.ConnectException: Connection timed out (Connection timed out)
Warning: Failed to download any source lists!
[=======================================] 100% Computing updates...
Android Studio / Appearance & Behaviour / System Settings / HTTP Proxy is correctly configured, and Check connection says Connection successful.
Android Studio / Appearance & Behaviour / System Settings / Android SDK does fetch updates without errors. I can even install new Android SDK Platforms.
Android Studio / Tools / Server Certificates has the correct certificate imported
http_proxy, https_proxy and no_proxy are correctly configured in my .profile.
Certificate is added to multiple keystores with sudo /usr/lib/jvm/default-java/bin/keytool -importcert -file /etc/ssl/certs/guardianCA.pem -keystore /usr/lib/jvm/default-java/jre/lib/security/cacerts.
~/.android/androidtool.cfg has yet another copypasta of my settings
I guess it's too late for a reply, I was going through the same problem. So answering now so that others can get help from it.
Basically SDK manager proxy hasn't been set so using command line proxy tunneling is helpful in this case.
This post has been helpful for me installing android command line tools using sdkmanager on windows.
If all the path variables are set properly
"%ANDROID_HOME%\tools\bin\sdkmanager" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository" --no_https --proxy=http --proxy_host=10.60.11.11 --proxy_port=8080
or
you can navigate to the directory where sdkmanager.bat file is set it in the path variable, or run this command directly from that location
sdkmanager "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository" --no_https --proxy=http --proxy_host=10.60.11.11 --proxy_port=8080

Cannot connect to Android Wear Device via bluetooth

I want to connect my Samsung Gear Live with my Samsung Smartphone Device and am trying to follow the giveninstruction. Also kept searching on stackoverflow with similar problems, but it seems that it is something else.
So this what happens when I am using the terminal to connect:
Denjos-MacBook-Pro-2:platform-tools Denjo$ cd /Users/Denjo/Library/Android/sdk/platform-tools
Denjos-MacBook-Pro-2:platform-tools Denjo$ ./adb forward tcp:4444 localabstract:/adb-hub
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device not found
error: device not found
Denjos-MacBook-Pro-2:platform-tools Denjo$
What am I probably doing wrong?
I solved it this way, that I changed the USB-cord.

Resources