Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
965 views
in Technique[技术] by (71.8m points)

java - Daemon not running. starting it now on port 5037 * Cannot open 'nul': The system cannot find the file specified

Eclipse gives following error while running android program...

Error 1:

[2015-12-10 16:10:37 - adb] Cannot open 'nul': The system cannot find the file specified. (2)
[2015-12-10 16:10:37 - ddms] 'D:android-sdk-windowsplatform-toolsadb.exe,start-server' failed -- run manually if necessary
[2015-12-10 16:10:37 - adb] * failed to start daemon *
[2015-12-10 16:10:37 - adb] error: cannot connect to daemon

And when I start from command line I get this error...

Error 2:

D:android-sdk-windowsplatform-tools>adb start-server
* daemon not running. starting it now on port 5037 *
Cannot open 'nul': The system cannot find the file specified. (2)
* failed to start daemon *
error: cannot connect to daemon

Previously even AVD Manager.exe and SDK manager.exe was not opening when I double click on it. After doing Rnd on google I found this post Android SDK manager won't open and I made changes to android.bat as follow :

I replace this

rem Check we have a valid Java.exe in the path.
set java_exe=
call libfind_java.bat
if not defined java_exe goto :EOF

with this code

set java_exe=C:Program FilesJavajdk1.7.0_75injava.exe

Now when I double click on AVD Manager.exe and SDK manager.exe it opens well.

I also checked with new eclipse (Mars) and added ADT plug in and created Hello World Application and tried to run but its gives same Error 1

Update 2:

I get below error..

D:>set ADB_TRACE=adb

D:>adb start-server
adb I  6072  2636 adb.cpp:219] Android Debug Bridge version 1.0.32
adb I  6072  2636 adb.cpp:219] Revision 09a0d98bebce-android
adb I  6072  2636 adb.cpp:219]
adb I  6072  2636 adb_client.cpp:126] _adb_connect: host:version
adb I  6072  2636 sysdeps_win32.cpp:742] could not connect to tcp:5037: cannot c
onnect to 127.0.0.1:5037: No connection could be made because the target machine
 actively refused it. (10061)
adb I  6072  2636 adb_client.cpp:175] adb_connect: service host:start-server
* daemon not running. starting it now on port 5037 *
Cannot open 'nul': The system cannot find the file specified. (2)
* failed to start daemon *
error: cannot connect to daemon

I checked whether port 5037 is used by other program but it is not showing

netstat -aon|findstr 5037

What is error exactly..system refused connection on port 5037 what does it mean how to resolve it. Can you please help me?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is pretty late answer, I doubt you nearly forgot about it, but it would help other people facing this issue.
Since you got this error :

Cannot open 'nul': The system cannot find the file specified. (2)
* failed to start daemon *
error: cannot connect to daemon

The problem is in the ADB.exe executable it self which may be corrupted or having permission or ownership issue.

If it is just a permission problem you can check it by copying (from "D:android-sdk-windowsplatform-tools") :

ADB.exe
AdbWinApi.dll
AdbWinUsbApi.dll

past it in a new folder in your desktop and run adb.exe devices in that directory (hold Shift and right click anywhere in the directory not in files and open command window here).
if you see this you are good:

* daemon not running. starting it now on port 5037 *
* daemon started successfully *

if it failed again ,then it is corrupted and you have to replace the whole 3 files
download them from here adbshell.com


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...