Describe the bug
Hi, I'm trying to query adb devices, pair and connect to them, but I'm having troubles even with the first part. Any request I execute ends in io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:5037 exception. This happens both on an emulator and a real device (both connected and disconnected from adb).
To Reproduce
I'm using following code similar to the example provided in docs.
StartAdbInteractor().execute()
val adb = AndroidDebugBridgeClientFactory().build()
val devices = adb.execute(request = ListDevicesRequest())
Log.d(TAG, "devices: $devices")
the same happens when running FetchDeviceFeaturesRequest. I tried changing the port with serverPort argument of StartAdbInteractor().execute() to 5038 and providing device serial to the feature request manually - none of those changed the behavior.
Expected behavior
No connection error would be thrown. Devices and features requests would run properly.
Screenshots
logs form the try-catch:
2025-09-04 11:47:22.993 21902-21902 System.err nodomain.pacjo.companion.watchface W io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:5037
2025-09-04 11:47:23.000 21902-21902 System.err nodomain.pacjo.companion.watchface W Caused by: java.net.ConnectException: Connection refused
2025-09-04 11:47:23.000 21902-21902 System.err nodomain.pacjo.companion.watchface W at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
2025-09-04 11:47:23.000 21902-21902 System.err nodomain.pacjo.companion.watchface W at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:762)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at java.lang.Thread.run(Thread.java:1119)
Android device (please complete the following information):
- Device: official emulator with SDK 36 / Redmi Note 10 Pro
- OS: official Android 16 / crDroid 12 (A16)
- Adam Version 0.5.10
- Android Debug Server Version not sure how to get this?
Additional context
I'm trying to run this inside an android app.
full logs from the app (opening the app, editing a text field (unrelated, but shows up in logs) and running the ADB code inside runBlocking:
2025-09-04 11:46:58.205 21902-21902 nativeloader nodomain.pacjo.companion.watchface D Configuring clns-9 for other apk /data/app/~~kcNhyUURDTeEXRXdoFyPPw==/nodomain.pacjo.companion.watchface-CIdc6CYjmQ6J7gZbDEw5Gg==/base.apk. target_sdk_version=36, uses_libraries=, library_path=/data/app/~~kcNhyUURDTeEXRXdoFyPPw==/nodomain.pacjo.companion.watchface-CIdc6CYjmQ6J7gZbDEw5Gg==/lib/x86_64:/data/app/~~kcNhyUURDTeEXRXdoFyPPw==/nodomain.pacjo.companion.watchface-CIdc6CYjmQ6J7gZbDEw5Gg==/base.apk!/lib/x86_64, permitted_path=/data:/mnt/expand:/data/user/0/nodomain.pacjo.companion.watchface
2025-09-04 11:46:58.225 21902-21902 anion.watchface nodomain.pacjo.companion.watchface I AssetManager2(0x716bd31a40b8) locale list changing from [] to [en-US]
2025-09-04 11:46:58.241 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V Currently set values for:
2025-09-04 11:46:58.241 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V angle_gl_driver_selection_pkgs=[]
2025-09-04 11:46:58.241 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V angle_gl_driver_selection_values=[]
2025-09-04 11:46:58.241 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V nodomain.pacjo.companion.watchface is not listed in per-application setting
2025-09-04 11:46:58.244 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V ANGLE allowlist from config: com.dreamgames.royalmatch com.dts.freefiremax com.dxx.firenow com.gramgames.mergedragons com.ludo.king com.mojang.minecraftpe com.my.defense com.nintendo.zaka com.os.airforce com.playrix.fishdomdd.gplay io.teslatech.callbreak jp.konami.prospia net.peakgames.toonblast
2025-09-04 11:46:58.244 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V nodomain.pacjo.companion.watchface is not listed in ANGLE allowlist or settings, returning default
2025-09-04 11:46:58.244 21902-21902 GraphicsEnvironment nodomain.pacjo.companion.watchface V Neither updatable production driver nor prerelease driver is supported.
2025-09-04 11:46:58.313 21902-21916 DisplayManager nodomain.pacjo.companion.watchface I Choreographer implicitly registered for the refresh rate.
2025-09-04 11:46:58.316 21902-21902 anion.watchface nodomain.pacjo.companion.watchface I AssetManager2(0x716bd319e938) locale list changing from [] to [en-US]
2025-09-04 11:46:58.337 21902-21902 ashmem nodomain.pacjo.companion.watchface E Pinning is deprecated since Android Q. Please use trim or other methods.
2025-09-04 11:46:58.400 21902-21902 CompatChangeReporter nodomain.pacjo.companion.watchface D Compat change id reported: 377864165; UID 10220; state: ENABLED
2025-09-04 11:46:58.402 21902-21902 DesktopModeFlags nodomain.pacjo.companion.watchface D Toggle override initialized to: OVERRIDE_UNSET
2025-09-04 11:46:58.481 21902-21916 EGL_emulation nodomain.pacjo.companion.watchface I Opening libGLESv1_CM_emulation.so
2025-09-04 11:46:58.482 21902-21916 EGL_emulation nodomain.pacjo.companion.watchface I Opening libGLESv2_emulation.so
2025-09-04 11:46:58.490 21902-21902 HWUI nodomain.pacjo.companion.watchface W Unknown dataspace 0
2025-09-04 11:46:58.536 21902-21916 HWUI nodomain.pacjo.companion.watchface W Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2025-09-04 11:46:58.537 21902-21916 HWUI nodomain.pacjo.companion.watchface W Failed to initialize 101010-2 format, error = EGL_SUCCESS
2025-09-04 11:46:58.804 21902-21902 anion.watchface nodomain.pacjo.companion.watchface I hiddenapi: Accessing hidden method Landroid/os/SystemProperties;->addChangeCallback(Ljava/lang/Runnable;)V (runtime_flags=0, domain=platform, api=unsupported) from Landroidx/compose/ui/platform/AndroidComposeView$Companion; (domain=app) using reflection: allowed
2025-09-04 11:46:58.872 21902-21906 anion.watchface nodomain.pacjo.companion.watchface I Compiler allocated 5042KB to compile void android.view.ViewRootImpl.performTraversals()
2025-09-04 11:47:00.548 21902-21912 HWUI nodomain.pacjo.companion.watchface I Davey! duration=1945ms; Flags=1, FrameTimelineVsyncId=1139384, IntendedVsync=24817563104752, Vsync=24817563104752, InputEventId=0, HandleInputStart=24817576658161, AnimationStart=24817576659051, PerformTraversalsStart=24817576659471, DrawStart=24819424143967, FrameDeadline=24817579771418, FrameStartTime=24817576645181, FrameInterval=16666666, WorkloadTarget=16666666, SyncQueued=24819457545216, SyncStart=24819458037807, IssueDrawCommandsStart=24819458110577, SwapBuffers=24819506390788, FrameCompleted=24819508905632, DequeueBufferDuration=3420, QueueBufferDuration=293461, GpuCompleted=24819508820262, SwapBuffersCompleted=24819508905632, DisplayPresentTime=0, CommandSubmissionCompleted=24819506390788,
2025-09-04 11:47:00.559 21902-21902 Choreographer nodomain.pacjo.companion.watchface I Skipped 113 frames! The application may be doing too much work on its main thread.
2025-09-04 11:47:00.908 21902-21902 InsetsController nodomain.pacjo.companion.watchface D hide(ime(), fromIme=false)
2025-09-04 11:47:00.921 21902-21902 ImeTracker nodomain.pacjo.companion.watchface I nodomain.pacjo.companion.watchface:1136ea79: onCancelled at PHASE_CLIENT_ALREADY_HIDDEN
2025-09-04 11:47:03.648 21902-21925 ProfileInstaller nodomain.pacjo.companion.watchface D Installing profile for nodomain.pacjo.companion.watchface
2025-09-04 11:47:13.471 21902-21902 Choreographer nodomain.pacjo.companion.watchface I Skipped 48 frames! The application may be doing too much work on its main thread.
2025-09-04 11:47:13.522 21902-21907 anion.watchface nodomain.pacjo.companion.watchface I Background concurrent mark compact GC freed 3397KB AllocSpace bytes, 0(0B) LOS objects, 49% free, 4388KB/8776KB, paused 179us,5.749ms total 103.818ms
2025-09-04 11:47:17.110 21902-21902 InsetsController nodomain.pacjo.companion.watchface D show(ime(), fromIme=false)
2025-09-04 11:47:17.122 21902-21902 ImeTracker nodomain.pacjo.companion.watchface I nodomain.pacjo.companion.watchface:6cc2a2d1: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT_BY_INSETS_API fromUser false
2025-09-04 11:47:17.127 21902-21902 InsetsController nodomain.pacjo.companion.watchface D Setting requestedVisibleTypes to -1 (was -9)
2025-09-04 11:47:17.167 21902-21902 AssistStructure nodomain.pacjo.companion.watchface I Flattened final assist data: 552 bytes, containing 1 windows, 3 views
2025-09-04 11:47:17.191 21902-21902 ImeTracker nodomain.pacjo.companion.watchface I nodomain.pacjo.companion.watchface:38ffceae: onRequestShow at ORIGIN_CLIENT reason SHOW_SOFT_INPUT fromUser false
2025-09-04 11:47:17.191 21902-21902 InsetsController nodomain.pacjo.companion.watchface D show(ime(), fromIme=false)
2025-09-04 11:47:17.191 21902-21902 ImeTracker nodomain.pacjo.companion.watchface I nodomain.pacjo.companion.watchface:38ffceae: onCancelled at PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES
2025-09-04 11:47:17.191 21902-21902 RemoteInpu...ectionImpl nodomain.pacjo.companion.watchface W requestCursorUpdates on inactive InputConnection
2025-09-04 11:47:17.287 21902-21902 Autofill Status nodomain.pacjo.companion.watchface D Autofill popup isn't shown because autofill is not available.
Did you set up autofill?
1. Go to Settings > System > Languages&input > Advanced > Autofill Service
2. Pick a service
Did you add an account?
1. Go to Settings > System > Languages&input > Advanced
2. Click on the settings icon next to the Autofill Service
3. Add your account
2025-09-04 11:47:20.091 21902-21902 InteractionJankMonitor nodomain.pacjo.companion.watchface W Initializing without READ_DEVICE_CONFIG permission. enabled=false, interval=1, missedFrameThreshold=3, frameTimeThreshold=64, package=nodomain.pacjo.companion.watchface
2025-09-04 11:47:20.763 21902-21902 Choreographer nodomain.pacjo.companion.watchface I Skipped 32 frames! The application may be doing too much work on its main thread.
2025-09-04 11:47:20.770 21902-21902 ImeTracker nodomain.pacjo.companion.watchface I nodomain.pacjo.companion.watchface:6cc2a2d1: onShown
2025-09-04 11:47:22.647 21902-21902 System.err nodomain.pacjo.companion.watchface W SLF4J(I): Connected with provider of type [org.slf4j.simple.SimpleServiceProvider]
2025-09-04 11:47:22.663 21902-21902 anion.watchface nodomain.pacjo.companion.watchface I hiddenapi: Accessing hidden method Lsun/misc/VM;->maxDirectMemory()J (runtime_flags=0, domain=core-platform, api=unsupported) from Lio/netty/util/internal/PlatformDependent; (domain=app) using reflection: allowed
2025-09-04 11:47:22.666 21902-21902 System.err nodomain.pacjo.companion.watchface W [main] INFO io.netty.util.internal.PlatformDependent - Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system instability.
2025-09-04 11:47:22.664 21902-21902 anion.watchface nodomain.pacjo.companion.watchface W type=1400 audit(0.0:7979): avc: denied { read } for name="somaxconn" dev="proc" ino=98140 scontext=u:r:untrusted_app:s0:c220,c256,c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0 app=nodomain.pacjo.companion.watchface
2025-09-04 11:47:22.719 21902-21902 anion.watchface nodomain.pacjo.companion.watchface I hiddenapi: Accessing hidden field Lsun/nio/ch/SelectorImpl;->selectedKeys:Ljava/util/Set; (runtime_flags=0, domain=core-platform, api=unsupported) from Lio/netty/channel/nio/NioEventLoop$4; (domain=app) using reflection: allowed
2025-09-04 11:47:22.719 21902-21902 anion.watchface nodomain.pacjo.companion.watchface I hiddenapi: Accessing hidden field Lsun/nio/ch/SelectorImpl;->publicSelectedKeys:Ljava/util/Set; (runtime_flags=0, domain=core-platform, api=unsupported) from Lio/netty/channel/nio/NioEventLoop$4; (domain=app) using reflection: allowed
2025-09-04 11:47:22.723 21902-21902 System.err nodomain.pacjo.companion.watchface W [main] WARN io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider - Default DNS servers: [/[2001:4860:4860::8888]:53, /[2001:4860:4860::8844]:53] (Google Public DNS as a fallback)
2025-09-04 11:47:22.792 21902-21936 System.err nodomain.pacjo.companion.watchface W [vert.x-eventloop-thread-0] WARN io.netty.util.internal.MacAddressUtil - Failed to find a usable hardware address from the network interfaces; using random bytes: 18:79:04:e7:03:65:77:bb
2025-09-04 11:47:22.968 21902-21936 anion.watchface nodomain.pacjo.companion.watchface W Verification of io.netty.util.concurrent.Promise io.netty.resolver.dns.InflightNameResolver.resolve(java.util.concurrent.ConcurrentMap, java.lang.String, io.netty.util.concurrent.Promise, boolean) took 160.880ms (515.91 bytecodes/s) (0B arena alloc)
2025-09-04 11:47:22.993 21902-21902 System.err nodomain.pacjo.companion.watchface W io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:5037
2025-09-04 11:47:23.000 21902-21902 System.err nodomain.pacjo.companion.watchface W Caused by: java.net.ConnectException: Connection refused
2025-09-04 11:47:23.000 21902-21902 System.err nodomain.pacjo.companion.watchface W at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
2025-09-04 11:47:23.000 21902-21902 System.err nodomain.pacjo.companion.watchface W at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:762)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2025-09-04 11:47:23.001 21902-21902 System.err nodomain.pacjo.companion.watchface W at java.lang.Thread.run(Thread.java:1119)
Describe the bug
Hi, I'm trying to query adb devices, pair and connect to them, but I'm having troubles even with the first part. Any request I execute ends in
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: /127.0.0.1:5037exception. This happens both on an emulator and a real device (both connected and disconnected from adb).To Reproduce
I'm using following code similar to the example provided in docs.
the same happens when running
FetchDeviceFeaturesRequest. I tried changing the port with serverPort argument of StartAdbInteractor().execute() to5038and providing device serial to the feature request manually - none of those changed the behavior.Expected behavior
No connection error would be thrown. Devices and features requests would run properly.
Screenshots
logs form the try-catch:
Android device (please complete the following information):
Additional context
I'm trying to run this inside an android app.
full logs from the app (opening the app, editing a text field (unrelated, but shows up in logs) and running the ADB code inside
runBlocking: