Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037 #45

Closed
mueller-ma opened this issue Apr 1, 2020 · 5 comments
Closed

Comments

@mueller-ma
Copy link

I created a workflow to run emulator tests, but the actions fails.

2020-04-01T13:07:39.2101708Z ##[group]Run ReactiveCircus/android-emulator-runner@v2.6.1
2020-04-01T13:07:39.2101841Z with:
2020-04-01T13:07:39.2101930Z   api-level: 29
2020-04-01T13:07:39.2102022Z   script: ./gradlew :mobile:connectedFullBetaDebugAndroidTest
2020-04-01T13:07:39.2102116Z   target: default
2020-04-01T13:07:39.2102200Z   arch: x86
2020-04-01T13:07:39.2102423Z   emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
2020-04-01T13:07:39.2102527Z   disable-animations: true
2020-04-01T13:07:39.2102598Z env:
2020-04-01T13:07:39.2102684Z   JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.242/x64
2020-04-01T13:07:39.2102782Z   JAVA_HOME_8.0.242_x64: /opt/hostedtoolcache/jdk/8.0.242/x64
2020-04-01T13:07:39.2102874Z ##[endgroup]
2020-04-01T13:07:39.2448292Z You're running a Linux VM where hardware acceleration is not available. Please consider using a macOS VM instead to take advantage of native hardware acceleration support provided by HAXM.
2020-04-01T13:07:39.2453305Z API level: 29
2020-04-01T13:07:39.2453809Z target: default
2020-04-01T13:07:39.2454302Z CPU architecture: x86
2020-04-01T13:07:39.2454673Z Hardware profile: 
2020-04-01T13:07:39.2455384Z emulator options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
2020-04-01T13:07:39.2455855Z disable animations: true
2020-04-01T13:07:39.2458159Z Script:
2020-04-01T13:07:39.2458963Z ./gradlew :mobile:connectedFullBetaDebugAndroidTest
2020-04-01T13:07:39.2472920Z Installing new cmdline-tools.
2020-04-01T13:07:39.2481419Z [command]sudo mkdir /usr/local/lib/android/sdk/cmdline-tools
2020-04-01T13:07:40.8949692Z [command]curl -fo commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip
2020-04-01T13:07:40.9028610Z   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
2020-04-01T13:07:40.9029228Z                                  Dload  Upload   Total   Spent    Left  Speed
2020-04-01T13:07:40.9029663Z 
2020-04-01T13:07:41.6276794Z   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
2020-04-01T13:07:41.6808452Z  90 77.8M   90 70.6M    0     0  97.4M      0 --:--:-- --:--:-- --:--:-- 97.2M
2020-04-01T13:07:41.6808867Z 100 77.8M  100 77.8M    0     0   100M      0 --:--:-- --:--:-- --:--:--  100M
2020-04-01T13:07:41.6827213Z [command]sudo unzip -q commandlinetools.zip -d /usr/local/lib/android/sdk/cmdline-tools
2020-04-01T13:07:42.9529418Z [command]sudo rm -f commandlinetools.zip
2020-04-01T13:07:42.9720802Z [command]sh -c \sudo chmod -R 777 /usr/local/lib/android/sdk
2020-04-01T13:08:28.3521938Z [command]sh -c \echo -e '
2020-04-01T13:08:28.3523008Z 84831b9409646a918e30573bab4c9c91346d8abd' > /usr/local/lib/android/sdk/licenses/android-sdk-preview-license
2020-04-01T13:08:28.3545519Z Installing latest build tools, platform tools, and platform.
2020-04-01T13:08:28.3546819Z [command]sh -c \sdkmanager --install 'build-tools;29.0.3' platform-tools 'platforms;android-29' > /dev/null
2020-04-01T13:08:32.3740389Z Installing latest emulator.
2020-04-01T13:08:32.3741668Z [command]sh -c \sdkmanager --install emulator > /dev/null
2020-04-01T13:08:45.9361963Z Installing system images.
2020-04-01T13:08:45.9363483Z [command]sh -c \sdkmanager --install 'system-images;android-29;default;x86' > /dev/null
2020-04-01T13:09:46.5783640Z Creating AVD without custom profile.
2020-04-01T13:09:46.5785078Z [command]sh -c \echo no | avdmanager create avd --force -n test --abi 'default/x86' --package 'system-images;android-29;default;x86'
2020-04-01T13:09:47.5430343Z Loading local repository...                                                     
2020-04-01T13:09:47.5431138Z [=========                              ] 25% Loading local repository...       
2020-04-01T13:09:47.5434381Z [=========                              ] 25% Fetch remote repository...        
2020-04-01T13:09:47.5667305Z [=======================================] 100% Fetch remote repository...       
2020-04-01T13:09:47.6193576Z Do you wish to create a custom hardware profile? [no] Starting emulator.
2020-04-01T13:09:47.6198422Z [command]sh -c \/usr/local/lib/android/sdk/emulator/emulator -avd test -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -accel off &
2020-04-01T13:09:48.2743463Z emulator: ERROR: AdbHostServer.cpp:102: Unable to connect to adb daemon on port: 5037
2020-04-01T13:09:48.7085706Z emulator: WARNING: x86 emulation may not work without hardware acceleration!
2020-04-01T13:09:48.7086115Z emulator: Cold boot: requested by the user
2020-04-01T13:09:48.7086206Z Your emulator is out of date, please update by launching Android Studio:
2020-04-01T13:09:48.7086883Z  - Start Android Studio
2020-04-01T13:09:48.7087177Z  - Select menu "Tools > Android > SDK Manager"
2020-04-01T13:09:48.7087417Z  - Click "SDK Tools" tab
2020-04-01T13:09:48.7087660Z  - Check "Android Emulator" checkbox
2020-04-01T13:09:48.7087885Z  - Click "OK"
2020-04-01T13:09:48.7090116Z 
2020-04-01T13:09:57.6242289Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:09:57.6268765Z * daemon not running; starting now at tcp:5037
2020-04-01T13:09:57.8401301Z * daemon started successfully
2020-04-01T13:09:57.8413034Z The process 'adb' failed with exit code 1
2020-04-01T13:09:57.8413435Z error: device offline
2020-04-01T13:09:59.8429187Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:09:59.8463917Z error: device offline
2020-04-01T13:09:59.8471795Z The process 'adb' failed with exit code 1
2020-04-01T13:10:01.8500835Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:01.8527142Z error: device offline
2020-04-01T13:10:01.8534481Z The process 'adb' failed with exit code 1
2020-04-01T13:10:03.8565701Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:03.8595552Z error: device offline
2020-04-01T13:10:03.8604192Z The process 'adb' failed with exit code 1
2020-04-01T13:10:05.8634082Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:05.8661082Z error: device offline
2020-04-01T13:10:05.8678987Z The process 'adb' failed with exit code 1
2020-04-01T13:10:07.8709542Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:07.8736608Z error: device offline
2020-04-01T13:10:07.8744138Z The process 'adb' failed with exit code 1
2020-04-01T13:10:09.8776127Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:09.8805271Z error: device offline
2020-04-01T13:10:09.8812753Z The process 'adb' failed with exit code 1
2020-04-01T13:10:11.8829167Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:11.8858030Z error: device offline
2020-04-01T13:10:11.8865125Z The process 'adb' failed with exit code 1
2020-04-01T13:10:13.8884316Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:13.8910017Z error: device offline
2020-04-01T13:10:13.8916757Z The process 'adb' failed with exit code 1
2020-04-01T13:10:15.8949053Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:15.8974618Z error: device offline
2020-04-01T13:10:15.8983230Z The process 'adb' failed with exit code 1
2020-04-01T13:10:17.8998877Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:17.9026233Z error: device offline
2020-04-01T13:10:17.9033751Z The process 'adb' failed with exit code 1
2020-04-01T13:10:19.9062247Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:19.9087631Z error: device offline
2020-04-01T13:10:19.9094115Z The process 'adb' failed with exit code 1
2020-04-01T13:10:21.9118290Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:21.9141754Z error: device offline
2020-04-01T13:10:21.9148222Z The process 'adb' failed with exit code 1
2020-04-01T13:10:23.9176772Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:23.9201759Z error: device offline
2020-04-01T13:10:23.9208267Z The process 'adb' failed with exit code 1
2020-04-01T13:10:25.9237983Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:28.5577583Z 
2020-04-01T13:10:30.5982353Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:33.7013035Z 
2020-04-01T13:10:35.7647269Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:38.2850873Z 
[The following block is shown again and again]
2020-04-01T13:10:40.3323868Z [command]adb shell getprop sys.boot_completed
2020-04-01T13:10:40.3356703Z error: no devices/emulators found
2020-04-01T13:10:40.3359986Z The process 'adb' failed with exit code 1
[10 minutes later]
2020-04-01T13:20:08.0432667Z The process 'adb' failed with exit code 1
2020-04-01T13:20:08.0435782Z [command]adb -s emulator-5554 emu kill
2020-04-01T13:20:08.0459275Z error: could not connect to TCP port 5554: Connection refused
2020-04-01T13:20:08.0477316Z The process 'adb' failed with exit code 1
2020-04-01T13:20:08.0480439Z ##[error]Timeout waiting for emulator to boot.
@ychescale9
Copy link
Member

Unfortunately on Linux API 28 and API 29 emulators are extremely slow to boot. In fact I've never seen an API 29 emulator booted successfully on Linux.

As mentioned in this issue, if you have to use Linux VM, you are probably limited to API 27 or below where startup times are still reasonable.

I know this is a disappointment but this is not something I have control...

mueller-ma added a commit to openhab/openhab-android that referenced this issue Apr 1, 2020
ReactiveCircus/android-emulator-runner#45
Signed-off-by: mueller-ma <mueller-ma@users.noreply.github.com>
@ychescale9
Copy link
Member

Closing now. Let me know if you need more help!

@mueller-ma
Copy link
Author

Yes, that helped. Thanks!
Now I'm getting these "couldn't find root view in 10 seconds" on API 27. I had these issue from time to time on Travis with a 22 emulator, so I tried 22. Now the action runs for over 3h and fails: https://github.com/openhab/openhab-android/runs/553253033

@ychescale9
Copy link
Member

Unfortunately this is not something I have control: as soon as the emulator is booted the environment is handed over to your script.


In general if you are using Linux VM, you'll get little benefits over other CI solution (perhaps other than easier configuration and less scripting) as there's no hardware acceleration on Linux (KVM not enabled).

While you can sort of have some emulators running without hardware acceleration, in practice you really need hardware acceleration enabled to run the Android Emulator, period. The emulator should just not start at all and throw an error if it can't be hardware-accelerated.

To give you (and everyone using linux VMs) a bit of context, I created this action solely to take advantage of hardware acceleration support on the macos VM and never intended to add Linux support cause I know it won't be a good experience (at least not better than what you already have) without hardware acceleration.

I wrote this article about running Android emulator on CI which should give you more context on running instrumentation tests on CI in general.

As an alternative you could look at Cirrus CI which provides KVM-enabled Linux VMs and pricing seems pretty reasonable (100% free for opensource projects). I wrote a long article going over all the features relevant to Android and how you can optimize your pipeline etc. I also created some templates to help you get started.

@ychescale9
Copy link
Member

#46

stefan-niedermann added a commit to stefan-niedermann/nextcloud-deck that referenced this issue Apr 18, 2020
stefan-niedermann added a commit to stefan-niedermann/nextcloud-deck that referenced this issue Apr 18, 2020
stefan-niedermann added a commit to stefan-niedermann/nextcloud-deck that referenced this issue Apr 18, 2020
* Trial and error - add instrumented tests to CI

* Trial and error - add instrumented tests to CI

Setup AVD

* Trial and error - add instrumented tests to CI

Fix action version

* Try API level 27 for AVD

ReactiveCircus/android-emulator-runner#45

* Try API level 29 for AVD on macos-latest image

ReactiveCircus/android-emulator-runner#45

* Explicitly watch instrumented test fail

* Fix instrumented tests and prepare merge into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants