ADB is not starting (no error message)

2019-02-16 14:27发布

I am trying to run adb. When I run : "adb start-server" it hangs during a while, and then no message.

After that the command "adb get-state" receive the answer "error: protocol fault (no status)" If I run then "adb kill-server" the answer is "* server not running *"

I am using windows 7. An admin has elevated my rights to local admin, but it did not solve anything.

I used resources monitor to verify if any other app is using the ports of adb, but it is not the case.

on https://developers.google.com/chrome-developer-tools/docs/remote-debugging the step 3 indicates to "Enable USB Web debugging" under Settings > Advanced > DevTools. But on my test phone, there is no "advanced" category in the chrome settings. I couldn't find out either what is the version of chrome installed.

Somewhere on the web I saw a suggestion to change the rights of "tmp/android/" to allow read & write for all users, but in C:\Users\me\AppData\Local\Android\android-sdk\temp there is no android folder.

So I am pretty desperate now, any help would be immensely appreciated.

thanks

-olivier

EDIT 1: I could't find "Enable USB Web debugging" because it was "android browser" and not chrome (a bit ridiculous yes). I did not know that. Using another device with a proper chrome installed, I could check the option there, but adb is still crashing at startup.

EDIT 2: I did a wild guess that there was some Write issue with the platform-tools folder. So I uninstalled everything using the sdk manager, I deleted the whole adt-bundle-windows-x86_64. Then I unzipped it elsewhere, on c:. Strange thing is, when I launch SDKManager.exe, several packages are already marked as installed :

  • Tools>Android SDK Tools
  • Tools>Android SDK Plateform-tools
  • Android 4.2.2>SDK Plateform
  • Android 4.2.2>ARM EABI v7a System Image
  • Extras>Android Support Library

I tried deinstall them again, delete the folder, unzip again and re-install, but still same result. It seems that somehow, it is installed wrong, but refuses to uninstall properly. Anyone knows how to force the unistallation ?

EDIT 3 : output of adb start-server after having used set ADB_TRACE=1

C:\adt-bundle-windows-x86_64-20130219\sdk\platform-tools>adb start-server
system/core/adb/adb.c::main():Handling commandline()
system/core/adb/adb_client.c::_adb_connect():_adb_connect: host:version
system/core/adb/sysdeps_win32.c::socket_loopback_client():socket_loopback_client: port 5037 type tcp => fd 100
system/core/adb/transport.c::writex():writex: fd=100 len=4: 30303063 000c
system/core/adb/transport.c::writex():writex: fd=100 len=12: 686f73743a76657273696f6e host:version
system/core/adb/transport.c::readx():readx: fd=100 wanted=4
system/core/adb/transport.c::readx():readx: fd=100 disconnected
system/core/adb/sysdeps_win32.c::adb_close():adb_close: 100(lo-client:5037)
system/core/adb/adb_client.c::adb_connect():adb_connect: service host:start-server

9条回答
欢心
2楼-- · 2019-02-16 15:09

I can think of a couple of scenarios in which you would encounter this behavior.

  1. (most likely) You're not running adb.exe as a priviledged user. Even though you're set up as a local admin, you're not running this command with elevated privileges. Since the default run->cmd is in normal user mode, this is expected. The following article explains how to run the command prompt as an admin / priviledged user. http://www.howtogeek.com/howto/windows-vista/run-a-command-as-administrator-from-the-windows-vista-run-box/

  2. (less likely) You may need to add adb.exe to the Windows firewall rules. Go to Control Panel -> Windows Firewall, and click on "advanced settings". Then, under "inbound Rules" and "outbound rules", add a rule for adb.exe as a program.

查看更多
看我几分像从前
3楼-- · 2019-02-16 15:12

The output can be pinned down to transport code:

D("readx: fd=%d wanted=%d\n", fd, (int)len);

while(len > 0) {
    r = adb_read(fd, p, len);
    if(r > 0) {
        len -= r;
        p += r;
    } else {
        if (r < 0) {
            D("readx: fd=%d error %d: %s\n", fd, errno, strerror(errno));
            if (errno == EINTR)
                continue;
        } else {
            D("readx: fd=%d disconnected\n", fd);
        }
        return -1;
    }

this might mean adb_read() returns 0 (EOF), while transport tries to read next 4. So, looks like the transport is not being able to read anything but EOF, and simply disconnects. This maybe a USB Driver issue.

Try using Linux, or running commands with root/admin privilege.

查看更多
来,给爷笑一个
4楼-- · 2019-02-16 15:12
  1. Uninstall Platform Tools in Android SDK Manager
  2. Find and delete all copies of AdbWinUsbApi.dll, AdbWinApi.dll and adb.exe
  3. Reinstall Platform Tools in Android SDK Manager
查看更多
Viruses.
5楼-- · 2019-02-16 15:15

At C:\Documents and Settings\userfoo.android there are some android-related files which uninstaller doesn't delete. Although the most of them are used by AVD, and not by ADB, I recommend you to delete it before any "new fresh" install.

Please check your user rights and privileges, and the user "system" privileges, because of in some companies, they are cutted-off to prevent from virus or automated attacks.

查看更多
SAY GOODBYE
6楼-- · 2019-02-16 15:19

What I did was end the adb.exe on my task manager, restarted Android Studio and then I connected my device again then everything went fine :D

查看更多
我命由我不由天
7楼-- · 2019-02-16 15:22

To solve problem in windows machine, try following :

Problem: ADB stop connecting attached Android device demon is not running and demon is running on port 5037

Solution:

first list all processes which are running on port 5037 command: netstat -ano | find "5037" Output for above command: TCP 127.0.0.1:52935 127.0.0.1:5037 SYN_SENT 31016 TCP 127.0.0.1:52936 127.0.0.1:5037 SYN_SENT 31016

Kill processes which are running on port 5037 : Command: taskkill /F /PID 31016

run adb kill-server output: * server not running *

run adb start-server * daemon not running. starting it now at tcp:5037 * * daemon started successfully *

run adb devices give you list of devices

查看更多
登录 后发表回答