Skip to content

Add support for Termux (Android) #52

Description

@hjfghycvdt

Check if target os is Android disable arboard

remote-client also needa an adjustment to use nodejs instead of bun

Compiling arboard v3.6.1
error[E0433]: cannot find `Clipboard` in `platform`
  --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:82:38
   |
82 | ...latform: platform::Clipboard::new()? })
   |                       ^^^^^^^^^ could not find `Clipboard` in `platform`

error[E0433]: cannot find `Clear` in `platform`
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:162:31
    |
162 | ...form::Clear::new(&mut self.platform) }
    |          ^^^^^ could not find `Clear` in `platform`

error[E0433]: cannot find `Get` in `platform`
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:167:29
    |
167 | ...atform::Get::new(&mut self.platform) }
    |            ^^^ could not find `Get` in `platform`

error[E0433]: cannot find `Set` in `platform`
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:172:29
    |
172 | ...atform::Set::new(&mut self.platform) }
    |            ^^^ could not find `Set` in `platform`

error[E0425]: cannot find type `Clipboard` in module `platform`
  --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:71:33
   |
71 |     pub(crate) platform: platform::Clipboard,
   |                                    ^^^^^^^^^ not found in `platform`

error[E0425]: cannot find type `Get` in module `platform`
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:179:33
    |
179 |     pub(crate) platform: platform::Get<'clipboard>,
    |                                    ^^^ not found in `platform`

error[E0425]: cannot find type `Set` in module `platform`
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:213:33
    |
213 |     pub(crate) platform: platform::Set<'clipboard>,
    |                                    ^^^ not found in `platform`

error[E0425]: cannot find type `Clear` in module `platform`
   --> /data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/arboard-3.6.1/src/lib.rs:259:33
    |
259 |     pub(crate) platform: platform::Clear<'clipboard>,
    |                                    ^^^^^ not found in `platform`

Some errors have detailed explanations: E0425, E0433.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `arboard` (lib) due to 8 previous errors
warning: build failed, waiting for other jobs to finish...

Activity

  1. hjfghycvdt commented on Sep 8, 2026

    @hjfghycvdt
    Author

    I asked Big Pickles to fix the previous error, and this is the result: Crabcode is running on Termux.

    Screenshot_2026_0908_213316.png

  2. yan-ad commented on Sep 9, 2026

    @yan-ad
    Contributor

    Thanks for confirming that Crabcode can run on Termux with the initial workaround.

    At the moment, Android/Termux is still experimental and unsupported in the current release train. The focused compatibility work addresses the build blocker from arboard and makes the remote client runnable with Node/npm.

    Image attachments are not supported on Android yet. arboard has no Android clipboard-image backend, so image paste needs a dedicated Android/Termux implementation rather than just disabling the dependency. Until that exists, the intended behavior is a clear unsupported-feature error instead of a failed build.

    We should treat a successful Termux launch as encouraging validation, not a support guarantee, until the Android build and runtime paths are covered by CI and documented.

  3. hjfghycvdt commented on Sep 10, 2026

    @hjfghycvdt
    Author

    Thanks for confirming that Crabcode can run on Termux with the initial workaround.

    At the moment, Android/Termux is still experimental and unsupported in the current release train. The focused compatibility work addresses the build blocker from arboard and makes the remote client runnable with Node/npm.

    Image attachments are not supported on Android yet. arboard has no Android clipboard-image backend, so image paste needs a dedicated Android/Termux implementation rather than just disabling the dependency. Until that exists, the intended behavior is a clear unsupported-feature error instead of a failed build.

    We should treat a successful Termux launch as encouraging validation, not a support guarantee, until the Android build and runtime paths are covered by CI and documented.

    I asked GPT, and it said we can use Termux:API for the clipboard.

    And here is an example of how to build CrabCode in GitHub Actions using a Termux Docker image:

    name: "Release (arm64: Termux)"
    
    on:
      push:
        branches: [main]
        tags: ["v*"]
      pull_request:
      workflow_dispatch:
    
    permissions:
      contents: read
    
    jobs:
      create-release:
        runs-on: ubuntu-26.04-arm
        permissions:
          contents: write
        steps:
          - name: Create / update GitHub Release
            if: startsWith(github.ref, 'refs/tags/v')
            uses: softprops/action-gh-release@v2
            with:
              generate_release_notes: true
    
      build-termux:
        name: Build Termux (aarch64, bionic)
        needs: create-release
        if: github.event_name != 'pull_request'
        runs-on: ubuntu-26.04-arm
        permissions:
          contents: write
        steps:
          - name: Checkout
            uses: actions/checkout@v4
            with:
              submodules: recursive
              fetch-depth: 0
    
          - name: Install Bun
            uses: oven-sh/setup-bun@v2
    
          - name: Build remote client
            shell: bash
            run: |
              cd remote-client
              bun install --frozen-lockfile
              bun run build
    
          - name: Verify remote client assets
            shell: bash
            run: test -s remote-client/dist/client/index.html
    
          - name: Pull termux-docker image
            run: docker pull termux/termux-docker:aarch64
    
          - name: Prepare host dist folder
            run: |
              mkdir -p "${{ github.workspace }}/dist"
              chmod -R 777 "${{ github.workspace }}/dist"
    
          - name: Build crabcode natively inside Termux
            run: |
              docker run --rm \
                -v "${{ github.workspace }}:/workspace:ro" \
                -v "${{ github.workspace }}/dist:/dist" \
                termux/termux-docker:aarch64 \
                bash -lc '
                  set -euo pipefail
                  PREFIX=/data/data/com.termux/files/usr
                  rm -f "$PREFIX/etc/apt/sources.list.d/termux.sources"
                  printf "deb https://packages.termux.dev/apt/termux-main stable main\n" > "$PREFIX/etc/apt/sources.list"
                  for i in 1 2 3; do apt update -y && break || sleep 5; done
                  for i in 1 2 3; do apt upgrade -y && break || sleep 5; done
                  apt install -y rust binutils pkg-config clang make openssl
                  rustc --version
                  cargo --version
                  cd /workspace
                  CARGO_TARGET_DIR=/dist/target cargo build --release --locked
                  mv /dist/target/release/crabcode /dist/crabcode-termux-aarch64
                '
    
          - name: Upload to GitHub Release
            if: startsWith(github.ref, 'refs/tags/v')
            env:
              GH_TOKEN: ${{ github.token }}
            run: gh release upload "$GITHUB_REF_NAME" dist/crabcode-termux-aarch64 --clobber
    
    
  4. hjfghycvdt commented on Sep 10, 2026

    @hjfghycvdt
    Author

    I tried this PRin my private repo, it builds successfully in Termux.

    img.png

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions