title: Android Studio error: cannot connect to daemon
body: <p>I've been using AS for months, but since two days I get an error when I try to run my app:</p>
  
  <pre><code>Unable to run 'adb': null
  'C:\Users\lapof\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary
  * daemon not running; starting now at tcp:5037
  could not read ok from ADB Server
  * failed to start daemon
  error: cannot connect to daemon
  </code></pre>
  
  <p>I've read about a lot of people having this problem, but the solutions provided don't work for me. I read these questions in particular:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/23104394/daemon-not-running-starting-it-now-on-port-5037">Daemon not running. Starting it now on port 5037</a></li>
  <li><a href="https://stackoverflow.com/questions/31837163/android-adb-daemon-still-not-running">Android ADB - Daemon still not running</a></li>
  <li><a href="https://stackoverflow.com/questions/23415746/how-to-resolve-the-adb-server-didnt-ack-error">How to resolve the &quot;ADB server didn&#39;t ACK&quot; error?</a></li>
  <li><a href="https://stackoverflow.com/questions/5703550/eclipse-error-adb-server-didnt-ack-failed-to-start-daemon">Eclipse error &quot;ADB server didn&#39;t ACK, failed to start daemon&quot;</a></li>
  <li><a href="https://stackoverflow.com/questions/2306322/adb-wont-start">Adb won&#39;t start</a></li>
  <li><a href="https://stackoverflow.com/questions/23415746/how-to-resolve-the-adb-server-didnt-ack-error">How to resolve the &quot;ADB server didn&#39;t ACK&quot; error?</a></li>
  <li><a href="https://stackoverflow.com/questions/34202232/daemon-not-running-starting-it-now-on-port-5037-cannot-open-nul-the-system">Daemon not running. starting it now on port 5037 * Cannot open &#39;nul&#39;: The system cannot find the file specified</a></li>
  </ul>
  
  <p>A lot of answers to these questions say to close adb.exe from task manager, the problem is that adb.exe is not running and if I try to restart it by typing <code>.\adb start-server</code> on a PowerShell window I get the same error.</p>
  
  <p>I also try to restart my PC but it didn't work. 
  On the Android device I'm trying to connect to (Samsung Galaxy S8) I enabled USB debugging. I even tried to eliminate all the authorized devices, but nothing worked.</p>
  
  <p>I checked if the 5037 port was used by other processes, but it is used by adb.exe (and the firewall state on that port is allowed and not limited). By the way, as I said, in the task manager adb.exe is not present.</p>
  
  <p>Last I tried to follow the instructions provided in the last question I linked (basically I re-downloaded adb.exe).
  Initially I ran <code>.\adb start-server</code> and this strange error occurs:</p>
  
  <pre><code>* daemon not running. starting it now on port 5037 *
  * daemon started successfully *
  ** daemon still not running
  error: cannot connect to daemon
  </code></pre>
  
  <p>and then when I try to run my app on Android Studio it occurs this new error when it tries to start adb:</p>
  
  <pre><code>Unable to run 'adb': null
  'C:\Users\lapof\AppData\Local\Android\Sdk\platform-tools\adb.exe start-server' failed -- run manually if necessary
  ADB server didn't ACK
  * failed to start daemon *
  </code></pre>
  
  <p>and then if I try to <code>.\adb kill-server</code> and then <code>.\adb start-server</code> or <code>.\adb devices</code> or <code>.\adb usb</code> the same error occurs again.
  Moreover when I connect my device now it asks me to authorize my PC to connect.</p>
  
  <p>I don't know if this can help, but lately I deactivated a lot of Windows services (but I don't think I deactivated something related to Android Studio).</p>
  
  <hr>
  
  <h2>Details</h2>
  
  <ul>
  <li><strong>PC</strong>: Compaq</li>
  <li><strong>PC OS</strong>: Windows 10 Home</li>
  <li><strong>Device</strong>: Samsung Galaxy S8 (Exynos)</li>
  <li><strong>Device OS</strong>: Android 8.0</li>
  <li><strong>AS version</strong>: 3.0.1</li>
  </ul>