Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
Asked Answered
S

6

13

I am stuck a whole afternoon trying to run again my small Android/Kotlin application in Android Studio. The message pasted on this question topic suddenly nocked me down.

I have done these tentatives:

1 - cold boot (On Virtual Devices screen > Actions > Cold Boot Now)

2 - I deleted my previous Virtual Device and I downloaded a new one (Nexus One)

3 - I followed all steps from other stackoverflow answer

3.1

cd C:\Users\Jimis\AppData\Local\Android\Sdk\platform-tool

adb kill-server
adb.exe start-server
adb devices -l 

3.2

deleted plataform-tool and redownlowaded it from SDK Plataform

3.3

restart computer

I am completely stuck.

Something called my attention: why so many PIDs to port 5037. See bellow that initially when I started Androdi Studio I had only 3 and after I tried debug my application I got a lot more.

Microsoft Windows [versão 10.0.18363.836]
(c) 2019 Microsoft Corporation. Todos os direitos reservados.

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>netstat -ano -p tcp |find "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11492
  TCP    127.0.0.1:5037         127.0.0.1:50582        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50714        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50731        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50734        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50736        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50737        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50738        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50739        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50740        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50741        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50742        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50743        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50744        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50745        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50746        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50747        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50748        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50749        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50750        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50751        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50752        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50753        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50754        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50755        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50756        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50757        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50758        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50759        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50760        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50761        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50762        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50763        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50764        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50765        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50766        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50767        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50768        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50769        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50770        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50771        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50772        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50773        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50779        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50780        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50781        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50782        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50783        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50784        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50785        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50786        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50787        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50788        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50789        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50790        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50791        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50792        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:50793        ESTABLISHED     11492
  TCP    127.0.0.1:5037         127.0.0.1:50794        ESTABLISHED     11492
  TCP    127.0.0.1:50582        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50714        127.0.0.1:5037         ESTABLISHED     792
  TCP    127.0.0.1:50717        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50719        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50722        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50729        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:50731        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50734        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50736        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50738        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50739        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50740        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50741        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50742        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50743        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50744        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50745        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50746        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50747        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50748        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50749        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50750        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50751        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50752        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50753        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50754        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50755        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50756        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50757        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50758        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50760        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50761        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50762        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50763        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50764        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50765        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50766        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50767        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50768        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50770        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50771        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50772        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50773        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50791        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50793        127.0.0.1:5037         ESTABLISHED     10052
  TCP    127.0.0.1:50794        127.0.0.1:5037         ESTABLISHED     10052

C:\Users\Jimis>

Trying to figure out with "netstat -a -b" why so many established connections to same port 5037 I reached this list but I don't if it is normal when using Android Studio and Emulator

...
     TCP    127.0.0.1:5037         SPANOT149:0            LISTENING
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50582        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50714        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50731        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50734        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50736        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50738        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50739        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50740        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50741        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50742        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50744        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50745        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50746        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50747        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50748        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50750        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50751        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50753        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50756        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50757        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50760        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50761        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50762        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50763        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50764        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50765        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50766        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50767        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50768        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50770        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50772        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50773        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50793        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50797        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:50955        ESTABLISHED
     [adb.exe]
      TCP    127.0.0.1:5037         orionhost:51276        ESTABLISHED
     [adb.exe]

My app build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    }

    defaultConfig {
        applicationId "com.mycomp.appfirestore"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    // Firebase Libraries
    implementation 'com.google.firebase:firebase-core:17.4.2'
    implementation 'com.google.firebase:firebase-auth:19.3.1'
    implementation 'com.google.firebase:firebase-database:19.3.0'
    implementation 'com.google.firebase:firebase-storage:19.1.1'

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
}

Project build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.71'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

*** added

in case it is relevant I just aupdated to Android Studio 4.0 and same issue.

Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 20, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1237M
Cores: 8
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: 

Reading a lot on stackoverflow I reached this other issue

I tried added advancedFeatures.ini in my C:\Users....android with

Vulkan = off
GLDirectMem = on

I don't know exactly what I did but I tried it anyway and I am still getting same issue. In this same stackoverflow discussion I noted someone talking about hyper-V.

In case it is relevant, I have turned off Hyper-V some time ago in my Windows 10 because I had to use VirtualBox for other reasons (OpenShift/minishift). I don't think it has relathionship with my issue because until 2 days ago I had not such problem with port 5037. BTW, I am curious: does Androids Emulators depend on HyperV somehow?

*** edited after Jacob's comment

Microsoft Windows [versão 10.0.18363.836] (c) 2019 Microsoft Corporation. Todos os direitos reservados.

1) Before I started Android Studio I had no connection to 5037 as expected

C:\Users>netstat -ano | findstr "5037"

2) Then I started Android Studio and I see at least three connections to port 5037.

C:\Users\Cast>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348

3) And when I click on Debug app (shift + F9) I get two messages errors on left bottom side of Android Studio

Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037

Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)

and a lot of connections with numerous TIME WAIT. It seems so weird to me.

C:\Users>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       11880
  TCP    127.0.0.1:5037         127.0.0.1:54602        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54631        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54643        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54647        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54648        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54649        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54650        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54662        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54663        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54665        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54666        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54667        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54668        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54669        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54670        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54671        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54672        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54673        ESTABLISHED     11880
  TCP    127.0.0.1:5037         127.0.0.1:54674        TIME_WAIT       0
  TCP    127.0.0.1:54602        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54631        127.0.0.1:5037         ESTABLISHED     5224
  TCP    127.0.0.1:54634        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54636        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54639        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54641        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54643        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54671        127.0.0.1:5037         ESTABLISHED     348
  TCP    127.0.0.1:54673        127.0.0.1:5037         ESTABLISHED     348

C:\Users>

Whole Event Log

01/06/2020
00:08   Gradle sync started
00:08   * daemon not running; starting now at tcp:5037
00:08   * daemon started successfully
00:08   Gradle sync finished in 2 s 418 ms (from cached state)
00:08   Executing tasks: [:app:assembleDebug] in project C:\WSs\FireStoreDemos\AppFirestore
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56296 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56296 above FD_SETSIZE (32768)
00:08   Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56668 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56928 above FD_SETSIZE (32768)
00:08   Emulator: socketTcpLoopbackClientFor: error: fd 56928 above FD_SETSIZE (32768)
00:08   Gradle build finished in 19 s 659 ms
00:08   Install successfully finished in 584 ms.: App restart successful without requiring a re-install.

*** edited after changed ADB port

I changed ANDROID_ADB_SERVER_PORT to 5038 in Windows Environment and restart Android Studio and I still see some 5037 waiting for connection.

After changed Environemnt Variable ANDROID_ADB_SERVER_PORT in Windows

C:\Users\>netstat -ano | findstr "5037"
  TCP    127.0.0.1:5037         127.0.0.1:54643        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54671        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:54673        TIME_WAIT       0
  TCP    127.0.0.1:5037         127.0.0.1:55204        TIME_WAIT       0
  TCP    127.0.0.1:54602        127.0.0.1:5037         TIME_WAIT       0
  TCP    127.0.0.1:54631        127.0.0.1:5037         TIME_WAIT       0

C:\Users\>netstat -ano | findstr "5038"
  TCP    127.0.0.1:5038         0.0.0.0:0              LISTENING       7912
  TCP    127.0.0.1:5038         127.0.0.1:55238        ESTABLISHED     7912
  TCP    127.0.0.1:55238        127.0.0.1:5038         ESTABLISHED     11368
Sato answered 29/5, 2020 at 21:10 Comment(2)
Does this answer your question? Problems with adb.exePeriscope
I had to run the adb server first. As suggested here: superuser.com/a/1530617/56505Reaganreagen
G
15

This is likely caused by insufficient permissions. Run Android Studio or your command prompt (whichever you prefer) as an administrator and that should solve your problem.

Geraldo answered 1/6, 2020 at 1:6 Comment(7)
Thanks for your effort to answer but before I posted here I have tried run Android Studio as administrator and nothing changed. Do you know why so many connections ESTABLISHED with port 5037? I guess it has nothing related to admin permission.Sato
Other possible help is if you know any trick to change the port number 5037 to other one. It may be a good try.Sato
I don't know specifically why there are so many connections to the adb port, but that's just how the daemon runs. I get numerous connections as well when my emulator is running fine. As for how to change the adb port, 5037 is the default if no ANDROID_ADB_SERVER_PORT environment variable is set. Set that env variable to your choosing, and that's what port it will try to use.Geraldo
Well, downgrade Android to 9 and API to 28 and I can finally see the screen working again. I don't consider I fix my original issue since I still getting the same error messages (see new details added to my question) and I would prefer to use Android 10. I think it is so contraditory I see "daemon not running; starting now at tcp:5037" whenever I start Android Studio and then I see again whenever I start debug "Emulator: emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037".Sato
Do you know if it is possible to disable Android Studio connect to port Emulator port and only connecct when I press either Run or Debug"? Do agree with me that it doesn't make sense Android Studio start a daemon if I am still not running the Emulator? Or from other perspective, if it was already started why not just use same connection instead of trying connect to adb daemon again when I reach "Debug"? I am not complaining. I just guess there is some wrong settup causing to try connect more than really necessary to the Emulator Port. Maybe I need disable from connecting when starting StudioSato
I have change port number by adding ANDROID_ADB_SERVER_PORT to 5038 and restarted Android Studio and I see there are still some connections to 5037 with TIME_WAIT. This may explain that there are some other service triggered by Android Studio holding 5037 unnecessary. See info updated aboveSato
Unfortunately, I don't have much more in depth knowledge of adb than I put in my last comment. Past that I'm not much help and can't explain the results you're seeing.Geraldo
D
9
1. emulator -list-avds
2. adb start-server 
3. emulator -avd <avd_name>

if you see PANIC: Missing emulator engine program for 'x86' CPU.

then you can try

1. emulator -list-avds
2. adb start-server
3. $ANDROID_HOME/emulator/emulator @name_device

for cold boot use flags -no-snapshot and -no-snapshot-load

Diacetylmorphine answered 19/8, 2020 at 7:34 Comment(0)
G
4

Try to start the adb daemon by cd'ing to your platform-tools dir and running adb start-server, after that emulate again your virtual device and you'll probably be golden

Grazia answered 24/1, 2021 at 13:58 Comment(0)
T
3

I had the same error as yours. I fixed it by updating everything in Android Studio, including the SDKs. After that, I wipe the data on my emulator and run the program. It works like a charm, hopefully you can fix yours, too.

Tinker answered 4/8, 2020 at 3:43 Comment(0)
R
0

Please also check the PATH defined in environment variables is correct. Open Command Prompt Type ECHO %PATH% and press Enter Key Check the path displayed on the screen

If the PATH is not correct, correct the same in Start - env - Environment Variables - Path

Rite answered 7/8, 2020 at 18:53 Comment(1)
you mean path for platform-toolsElbring
B
-1

Problem with can sometime happens because you have virtual machine in windows, and the way windows 10 disabled the windows features vary.

So if you use windows 10 Pro, then you have to make sure you turn off the hyper V and virtual machine platform.

Then restart pc it will fix the error.

and don't forget to run

  1. adb start-server
  2. emulator -adb "andname"

and also make sure you setup the environment for

  1. ANDROID_AVB_HOME = C:\Users\fernando.android\avd

then inside the path add the emulator directory as well

  1. C:\Users"username"\AppData\Local\Android\Sdk\emulator
  2. C:\Users"username"\AppData\Local\Android\Sdk\emulator\bin64
  3. C:\Users"username"\AppData\Local\Android\Sdk\platform-tools
  4. C:\Users\fernando\AppData\Local\Android\Sdk\tools
  5. C:\Users\fernando\AppData\Local\Android\Sdk\tools\bin

Make sure everything is in order.

Cheer I hope it help you guys

Bron answered 14/6, 2021 at 5:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.