Skip to content

Android 0.3.0: can't connect to LAN servers on Android 17 (missing ACCESS_LOCAL_NETWORK) #62934

Closed

Description

@osctorand

Description

The Android app targets SDK 37 but doesn't declare android.permission.ACCESS_LOCAL_NETWORK. On Android 17, apps targeting SDK 37 need that permission to reach the local network, so the OS drops the connection before it leaves the phone. Pairing fails with a timeout, the server never sees a connection, and the app has no local network permission for the user to grant.

Fix: declare ACCESS_LOCAL_NETWORK in the manifest and request it at runtime before connecting to a local address. https://developer.android.com/privacy-and-security/local-network-permission

Plugins

No response

OpenCode version

Android app 0.3.0 (39), server 2.2.6

Steps to reproduce

  1. Use an Android 17 device on Wi-Fi with no VPN, and run an OpenCode server on the same subnet.
  2. On the server, run opencode pair --url http://<hostname>.local:4096.
  3. Scan the QR code in the app.

Result: URLError -1001 timedOut after about 15 s. The app logs GET /auth/…: URLError -1001 (SocketTimeoutException), a packet capture on the server shows no SYN, and adb shell dumpsys appops --package ai.opencode.mobilecode shows a Reject for ACCESS_LOCAL_NETWORK.

Expected: the app asks for the local network permission and connects.

Screenshot

No response

Operating System

Android 17 (API 37)

Terminal

No response

Activity

  1. opencodejr commented on Nov 9, 2026

    @opencodejr
    Contributor

    Thanks for the detailed diagnosis, @osctorand: the packet capture and the dumpsys appops output make the cause very clear.

    I couldn't reproduce this in our automated environment. It has no Android 17 device or emulator and no copy of the 0.3.0 (39) build, and the Android app's source isn't in this repository, so I couldn't check its manifest either. A maintainer with access to the mobile app will need to confirm that ACCESS_LOCAL_NETWORK is missing and that pairing over the LAN fails on API 37.

    The server side (2.2.6 and opencode pair) doesn't look involved, since no connection attempt ever reached the server.

    Related, though not the same problem:

  2. a-wayne commented on Nov 9, 2026

    @a-wayne

    I'm having the same issue. I just updated my S24 Ultra to Android 17. There's no way to manually give the app this permission without it asking first, so I suppose we'll have to wait.

  3. christian-taillon commented on Nov 11, 2026

    @christian-taillon

    Confirming the same issue on a Google Pixel 9 running Android 17 (API 37).

    Environment:

    • OpenCode Mobile: 0.3.0 (build 39)
    • Android: 17 (API 37)
    • App target SDK: 37
    • Package: ai.opencode.mobilecode
    • Server: OpenCode 2.x on Fedora Linux, accessible over LAN

    Observed behavior:

    • Manual connection using the correct server URL and credentials fails with URLError -1001 timedOut.
    • QR code pairing fails with the same timeout.
    • Chrome on the same phone successfully reaches the server and receives HTTP 401 (Authentication required), confirming network reachability.
    • Another device on the same network can authenticate to the server successfully.
    • Android Settings does not expose a Local Network permission for OpenCode.

    ADB verification:

    adb shell getprop ro.build.version.sdk
    # 37
    
    adb shell dumpsys package ai.opencode.mobilecode | grep -iE 'targetSdk|ACCESS_LOCAL_NETWORK'
    # versionCode=39 minSdk=35 targetSdk=37
    # No ACCESS_LOCAL_NETWORK declaration found

    This independently reproduces the reported behavior and supports the missing ACCESS_LOCAL_NETWORK permission diagnosis.

    Both manual authentication and QR pairing are affected. I can test a patched Android build if helpful.

  4. Tarquinen commented on Nov 11, 2026

    @Tarquinen
    Member

    This will be fixed in the next release just waiting for google play approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions