Is it possible to disable the Daemon started by default when starting Android Studio?

北慕城南 提交于 2020-06-17 15:25:46

问题


I am very new to Android Development. Whenever I started Android Studio I get in Event Log panel:

03/06/2020
21:23   Gradle sync started

21:23   * daemon not running; starting now at tcp:5038

21:23   * daemon started successfully

21:23   Gradle sync finished in 2 s 618 ms (from cached state)

I guess such daemon is the Android Emulator somehow manage by ADB server. I see soon I start Android Studio:

C:\Users\cast>netstat -ano | findstr "5038"
  TCP    127.0.0.1:5038         0.0.0.0:0              LISTENING       4976
  TCP    127.0.0.1:5038         127.0.0.1:62710        ESTABLISHED     4976
  TCP    127.0.0.1:62710        127.0.0.1:5038         ESTABLISHED     13332

Mine is 5038 instead of 5037 because I created a Windows System Environment variable for learning purposes: ANDROID_ADB_SERVER_PORT

From idea.log I see

2020-06-03 21:23:53,286 [   9135]   INFO - roid.tools.idea.adb.AdbService - Initializing adb using: C:\Users\Cast\AppData\Local\Android\Sdk\platform-tools\adb.exe 

So I easily guess it triggers automatically during Android Studio initializion adb.exe start-server

If so, I would expect get some result from command bellow but I don't at all

C:\Users\Cast\AppData\Local\Android\Sdk\platform-tools>adb devices -l
List of devices attached


C:\Users\Cast\AppData\Local\Android\Sdk\platform-tools>

So, my straight question is: if possible, how disable such automatic startup?

Some usefull comments that may help me reach a solution for my issue is:

1) is this daemon started by Android Studio or by Gradle somehow?

2) Does Android Studio really depends on this daemon up and running while I am not running neither debugging the application. Let's say I only want to browse the project code. Well, since I have Angular/Java background I can't understand why starting a server if I don't want.

3) why two ESTABLISHED connections and on LISTENNING and soon I start run/debug the application I got many more connections?

In case it is relavant, here is my AVD

C:\Users\Cast\AppData\Local\Android\Sdk\emulator>emulator -list-avds
Pixel_3a_API_28

Here are my whole Android Studio logs during startup

2020-06-03 21:23:44,151 [      0]   INFO -        #com.intellij.idea.Main - ------------------------------------------------------ IDE STARTED ------------------------------------------------------ 
2020-06-03 21:23:44,204 [     53]   INFO -        #com.intellij.idea.Main - JNA library (64-bit) loaded in 38 ms 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - IDE: Android Studio (build #AI-193.6911.18.40.6514223, 20 May 2020 12:07) 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - OS: Windows 10 (10.0, amd64) 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - JRE: 1.8.0_242-release-1644-b01 (JetBrains s.r.o) 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - JVM: 25.242-b01 (OpenJDK 64-Bit Server VM) 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - JVM Args: exit -Xms256m -Xmx1280m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -Dsun.io.useCanonPrefixCache=false -Djava.net.preferIPv4Stack=true -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true -Djna.nosys=true -Djna.boot.library.path= -Djb.vmOptionsFile=C:\Program Files\Android\Android Studio\bin\studio64.exe.vmoptions -Djava.library.path=C:\Program Files\Android\Android Studio\jre\jre\bin;C:\Program Files\Android\Android Studio\jre\jre\bin\server -Didea.platform.prefix=AndroidStudio -Didea.jre.check=true -Dide.native.launcher=true -Didea.paths.selector=AndroidStudio4.0 -XX:ErrorFile=C:\Users\Cast\java_error_in_studio_%p.log -XX:HeapDumpPath=C:\Users\Cast\java_error_in_studio.hprof 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - ext: C:\Program Files\Android\Android Studio\jre\jre\lib\ext: [access-bridge-64.jar, cldrdata.jar, dnsns.jar, jaccess.jar, localedata.jar, meta-index, nashorn.jar, sunec.jar, sunjce_provider.jar, sunmscapi.jar, sunpkcs11.jar, zipfs.jar] 
2020-06-03 21:23:44,251 [    100]   INFO -        #com.intellij.idea.Main - charsets: JNU=Cp1252 file=Cp1252 
2020-06-03 21:23:44,367 [    216]   INFO - ntellij.idea.ApplicationLoader - CPU cores: 8; ForkJoinPool.commonPool: java.util.concurrent.ForkJoinPool@7cc9ae70[Running, parallelism = 7, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]; factory: com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory@20ce88a8 
2020-06-03 21:23:44,605 [    454]   INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational 
2020-06-03 21:23:45,075 [    924]   INFO - llij.ide.plugins.PluginManager - Plugin "Groovy" misses optional descriptor duplicates-groovy.xml 
2020-06-03 21:23:45,075 [    924]   INFO - llij.ide.plugins.PluginManager - Plugin "Groovy" misses optional descriptor duplicates-detection-groovy.xml 
2020-06-03 21:23:45,191 [   1040]   INFO - llij.ide.plugins.PluginManager - Plugin "Java" misses optional descriptor profiler-java.xml 
2020-06-03 21:23:45,297 [   1146]   INFO - llij.ide.plugins.PluginManager - Loaded bundled plugins: Android APK Support (1.0), Android Games (1.0), Android NDK Support (1.0), Android Support (10.4.0), App Links Assistant (0.1), ChangeReminder (193.6911.18.40.6514223), Compose (0.1.0-dev03), Configuration Script (193.6911.18.40.6514223), Copyright (193.6911.18.40.6514223), Coverage (193.6911.18.40.6514223), EditorConfig (193.6911.18.40.6514223), Firebase App Indexing (0.1), Firebase Services (0.1), Firebase Testing (1.0), Git (193.6911.18.40.6514223), GitHub (193.6911.18.40.6514223), Google Cloud Tools Core (0.2.8), Google Cloud Tools For Android Studio (0.2.8), Google Developers Samples (0.3.1), Google Login (1.0), Google Services (0.1), Gradle (193.6911.18.40.6514223), Gradle-Java (193.6911.18.40.6514223), Groovy (193.6911.18.40.6514223), IDEA CORE (193.6911.18.40.6514223), IntelliLang (193.6911.18.40.6514223), JUnit (193.6911.18.40.6514223), Java (193.6911.18.40.6514223), Java Bytecode Decompiler (193.6911.18.40.6514223), Java IDE Customization (193.6911.18.40.6514223), Java Internationalization (193.6911.18.40.6514223), Java Stream Debugger (193.6911.18.40.6514223), Kotlin (1.3.72-release-Studio4.0-1), Layoutlib Native (1.0), Layoutlib Standard (1.0), Mercurial (193.6911.18.40.6514223), Properties (193.6911.18.40.6514223), Settings Repository (193.6911.18.40.6514223), Shell Script (193.6911.18.40.6514223), Smali Support (193.6911.18.40.6514223), Subversion (193.6911.18.40.6514223), Task Management (193.6911.18.40.6514223), Terminal (193.6911.18.40.6514223), Test Recorder (1.0), TestNG (193.6911.18.40.6514223), TextMate bundles (193.6911.18.40.6514223), YAML (193.6911.18.40.6514223) 
2020-06-03 21:23:46,141 [   1990]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=500; buffer=10; max=1217 
2020-06-03 21:23:46,156 [   2005]   INFO - tellij.util.io.FileChannelUtil - interruptible FileChannel-s will be used for indexes 
2020-06-03 21:23:46,210 [   2059]   INFO - com.intellij.ide.ui.UISettings - Loaded: fontSize=13, fontScale=1.0; restored: fontSize=13, fontScale=1.0 
2020-06-03 21:23:46,279 [   2128]   INFO - til.net.ssl.CertificateManager - Default SSL context initialized 
2020-06-03 21:23:46,294 [   2143]   INFO - rains.ide.BuiltInServerManager - built-in server started, port 63342 
2020-06-03 21:23:46,294 [   2143]   INFO - pl.local.NativeFileWatcherImpl - Starting file watcher: C:\Program Files\Android\Android Studio\bin\fsnotifier64.exe 
2020-06-03 21:23:46,326 [   2175]   INFO - pl.local.NativeFileWatcherImpl - Native file watcher is operational. 
2020-06-03 21:23:46,341 [   2190]   INFO - gs.impl.UpdateCheckerComponent - channel: release 
2020-06-03 21:23:46,473 [   2322]   WARN - nSystem.impl.ActionManagerImpl - keymap "ReSharper" not found [Plugin: com.android.tools.ndk] 
2020-06-03 21:23:47,197 [   3046]   INFO - pl$FileIndexDataInitialization - Initialization done: 970 
2020-06-03 21:23:47,360 [   3209]   INFO - exImpl$StubIndexInitialization - Initialization done: 154 
2020-06-03 21:23:48,415 [   4264]   INFO - pl.projectlevelman.NewMappings - VCS Root: [Git] - [C:/WSs/FireStoreDemos] 
2020-06-03 21:23:50,388 [   6237]   INFO - artup.AndroidStudioInitializer - Failed to disable 'org.intellij.plugins.intelliLang.inject.groovy.GrConcatenationInjector' 
2020-06-03 21:23:50,495 [   6344]   INFO - j.ide.script.IdeStartupScripts - 0 startup script(s) found 
2020-06-03 21:23:51,118 [   6967]   WARN - ugins.textmate.TextMateService - Missing builtin bundles, checked: 
C:/Users/Cast/.AndroidStudio4.0/config/plugins/textmate/lib/bundles
C:/Program Files/Android/Android Studio/plugins/textmate/lib/bundles 
2020-06-03 21:23:51,129 [   6978]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 162ms; general responsiveness: ok; EDT responsiveness: ok 
2020-06-03 21:23:51,527 [   7376]   WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider 
2020-06-03 21:23:52,853 [   8702]   INFO - ngd.lsp.ClangDaemonContextImpl - Using clangd from: C:\Program Files\Android\Android Studio\bin\clang\win\clangd.exe 
2020-06-03 21:23:52,925 [   8774]   INFO - .diagnostic.PerformanceWatcher - Post-startup activities under progress took 2120ms; general responsiveness: ok; EDT responsiveness: 1/2 sluggish 
2020-06-03 21:23:53,024 [   8873]   INFO - tartup.impl.StartupManagerImpl - C:/WSs/FireStoreDemos/AppFirestore/.idea case-sensitivity: expected=false actual=false 
2020-06-03 21:23:53,172 [   9021]   INFO - tor.impl.FileEditorManagerImpl - Project opening took 5355 ms 
2020-06-03 21:23:53,191 [   9040]   INFO -  #git4idea.commands.GitHandler - [.] git version 
2020-06-03 21:23:53,286 [   9135]   INFO - roid.tools.idea.adb.AdbService - Initializing adb using: C:\Users\Cast\AppData\Local\Android\Sdk\platform-tools\adb.exe 
2020-06-03 21:23:53,958 [   9807]   INFO -  #git4idea.commands.GitHandler - git version 2.13.3.windows.1 
2020-06-03 21:23:54,041 [   9890]   INFO - ea.config.GitExecutableManager - Git version for C:\Program Files\Git\cmd\git.exe : 2.13.3 
2020-06-03 21:23:54,860 [  10709]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 3730ms; general responsiveness: ok; EDT responsiveness: 1/3 sluggish 
2020-06-03 21:23:54,877 [  10726]   INFO -       #com.jetbrains.cidr.lang - Clearing symbols finished in 4 ms 
2020-06-03 21:23:54,884 [  10733]   INFO -       #com.jetbrains.cidr.lang - Building symbols in FAST mode, 0 source files from total 0 project files 
2020-06-03 21:23:55,107 [  10956]   INFO -       #com.jetbrains.cidr.lang - Loading symbols finished in 230 ms 
2020-06-03 21:23:55,111 [  10960]   INFO -       #com.jetbrains.cidr.lang - Loading Header Maps finished in 4 ms 
2020-06-03 21:23:55,134 [  10983]   INFO -       #com.jetbrains.cidr.lang - Loading Module Maps finished in 22 ms 
2020-06-03 21:23:55,135 [  10984]   INFO -       #com.jetbrains.cidr.lang - Loaded 0 module maps in 0 packs for 0 search roots 
2020-06-03 21:23:55,136 [  10985]   INFO -       #com.jetbrains.cidr.lang - Saved 0 module maps in 0 packs 
2020-06-03 21:23:55,136 [  10985]   INFO -       #com.jetbrains.cidr.lang - Saving Module Maps finished in 0 ms 
2020-06-03 21:23:55,136 [  10985]   INFO -       #com.jetbrains.cidr.lang - Loaded 0 tables for 0 files (0 project files) 
2020-06-03 21:23:55,138 [  10987]   INFO -       #com.jetbrains.cidr.lang - Building symbols for 0 source files 
2020-06-03 21:23:55,145 [  10994]   INFO -       #com.jetbrains.cidr.lang - Updating Symbols finished in 4 ms 
2020-06-03 21:23:55,145 [  10994]   INFO -       #com.jetbrains.cidr.lang - Building symbols for 0 unused headers 
2020-06-03 21:23:55,149 [  10998]   INFO -       #com.jetbrains.cidr.lang - Updating Symbols finished in 2 ms 
2020-06-03 21:23:55,149 [  10998]   INFO -       #com.jetbrains.cidr.lang - Updating Symbols finished in 2 ms 
2020-06-03 21:23:55,149 [  10998]   INFO -       #com.jetbrains.cidr.lang - Saving modified symbols for 0 files (0 tables of total 0) 
2020-06-03 21:23:55,152 [  11001]   INFO -       #com.jetbrains.cidr.lang - Saving symbols finished in 3 ms 
2020-06-03 21:23:55,523 [  11372]   INFO - ge.ExternalProjectsDataStorage - Load external projects data in 339 millis (read time: 323) 
2020-06-03 21:23:56,008 [  11857]   INFO - e.project.sync.GradleSyncState - Started single-variant sync with Gradle for project 'AppFirestore'. 
2020-06-03 21:23:56,126 [  11975]   INFO - e.project.sync.GradleSyncState - Started setup of project 'AppFirestore'. 
2020-06-03 21:23:56,455 [  12304]   WARN -            #com.android.ddmlib - * daemon not running; starting now at tcp:5038 
2020-06-03 21:23:56,524 [  12373]   WARN -            #com.android.ddmlib - * daemon started successfully 
2020-06-03 21:23:56,540 [  12389]   INFO -            #com.android.ddmlib - Connected to adb for device monitoring 
2020-06-03 21:23:56,742 [  12591]   INFO - roid.tools.idea.adb.AdbService - Successfully connected to adb 
2020-06-03 21:23:56,993 [  12842]   INFO - rationStore.ComponentStoreImpl - Saving appJavaCodeFoldingSettings took 16 ms 
2020-06-03 21:23:57,061 [  12910]   INFO - ge.ExternalProjectsDataStorage - Save external projects data in 33 ms 
2020-06-03 21:23:57,156 [  13005]   WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptInputsWatcher$Storage 
2020-06-03 21:23:57,203 [  13052]   WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.kotlin.idea.core.script.configuration.utils.ScriptClassRootsStorage 
2020-06-03 21:23:57,240 [  13089]   INFO - rationStore.ComponentStoreImpl - Saving Project (name=AppFirestore, containerState=ACTIVE, componentStore=C:\WSs\FireStoreDemos\AppFirestore) CompilerConfiguration took 15 ms, GradleMigrationSettings took 16 ms, ProjectCodeStyleConfiguration took 31 ms, ProjectView took 16 ms, libraryTable took 16 ms, navEditor-manualLayoutAlgorithm2 took 15 ms 
2020-06-03 21:23:57,810 [  13659]   INFO - ule.android.SdkModuleSetupStep - Set Android SDK 'Android API 29 Platform' (C:/Users/Cast/AppData/Local/Android/Sdk) to module 'app' 
2020-06-03 21:23:58,263 [  14112]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2020-06-03 21:23:58,347 [  14196]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2020-06-03 21:23:58,363 [  14212]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 0ms; general responsiveness: ok; EDT responsiveness: ok 
2020-06-03 21:23:58,394 [  14243]   INFO - testKnownPluginVersionProvider - 'gradle' plugin missing from the offline Maven repo, will use default 4.0.0 
2020-06-03 21:23:58,394 [  14243]   INFO - .MemorySettingsPostSyncChecker - 64bits? : true, current: 1280, available RAM: 16238 
2020-06-03 21:23:58,410 [  14259]   INFO - s.MemorySettingsRecommendation - recommendation based on machine: 3072, on project: 1280 
2020-06-03 21:23:58,494 [  14343]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 131ms; general responsiveness: ok; EDT responsiveness: ok 
2020-06-03 21:23:58,510 [  14359]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Android/Android Studio/jre 
2020-06-03 21:23:58,610 [  14459]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2020-06-03 21:23:58,626 [  14475]   INFO - e.project.sync.GradleSyncState - Gradle sync finished in 2 s 618 ms (from cached state) 
2020-06-03 21:23:58,711 [  14560]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 16ms; general responsiveness: ok; EDT responsiveness: ok 
2020-06-03 21:23:58,711 [  14560]   INFO - roid.tools.ndk.GradleWorkspace - Updating model took 0.063s 
2020-06-03 21:23:58,811 [  14660]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 100ms; general responsiveness: ok; EDT responsiveness: ok 
2020-06-03 21:24:00,152 [  16001]   INFO - CompilerWorkspaceConfiguration - Available processors: 8 
2020-06-03 21:24:16,176 [  32025]   INFO - rationStore.ComponentStoreImpl - Saving Module: 'app'FacetManager took 22 ms 
2020-06-03 21:24:16,207 [  32056]   INFO - rationStore.ComponentStoreImpl - Saving Project (name=AppFirestore, containerState=ACTIVE, componentStore=C:\WSs\FireStoreDemos\AppFirestore) libraryTable took 15 ms 
2020-06-03 21:26:00,091 [ 135940]   INFO - rationStore.ComponentStoreImpl - Saving Project (name=AppFirestore, containerState=ACTIVE, componentStore=C:\WSs\FireStoreDemos\AppFirestore) ProjectCodeStyleConfiguration took 19 ms, libraryTable took 15 ms 
2020-06-03 21:34:43,881 [ 659730]   INFO - rationStore.ComponentStoreImpl - Saving Project (name=AppFirestore, containerState=ACTIVE, componentStore=C:\WSs\FireStoreDemos\AppFirestore) GradleSettings took 16 ms, libraryTable took 15 ms 

And my gradle builds

build.gradle (project)

// 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:4.0.0'
        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
}

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"
        multiDexEnabled true

        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'

    //Firestore Libraries
    implementation 'com.google.firebase:firebase-firestore:21.2.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'

    //https://stackoverflow.com/a/49645970/4148175
    implementation 'com.android.support:multidex:1.0.3'
}

*** edited

C:\Users\Cast\AppData\Local\Android\Sdk\platform-tools>netstat -ano | findstr "5038"
  TCP    127.0.0.1:5038         0.0.0.0:0              LISTENING       19440
  TCP    127.0.0.1:5038         127.0.0.1:63707        ESTABLISHED     19440
  TCP    127.0.0.1:63707        127.0.0.1:5038         ESTABLISHED     14520

C:\Users\Cast\AppData\Local\Android\Sdk\platform-tools>taskkill /pid 19440 /f

and then in Android Studio

04/06/2020
05:43   * daemon not running; starting now at tcp:5038

05:43   * daemon started successfully

05:43   Gradle sync started

05:43   Gradle sync finished in 1 s 749 ms (from cached state)

05:44   Adb connection Error:Foi forçado o cancelamento de uma conexão existente pelo host remoto

05:44   Cannot reach ADB server, attempting to reconnect.

05:44   * daemon not running; starting now at tcp:5038

05:44   * daemon started successfully

来源:https://stackoverflow.com/questions/62185020/is-it-possible-to-disable-the-daemon-started-by-default-when-starting-android-st

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!