Skip to content

Add Capacitor setup and GitHub Workflow for building Android APK - #8048

Open
bhawan-kavinda wants to merge 11 commits into
coder:mainfrom
bhawan-kavinda:main
Open

bhawan-kavinda wants to merge 11 commits into
coder:mainfrom
bhawan-kavinda:main

Conversation

@bhawan-kavinda

Copy link
Copy Markdown

Summary

This PR adds the necessary Capacitor configurations and a GitHub Actions workflow to build the code-server project as an Android Mobile App (APK).

Proposed Changes

  • GitHub Workflow Addition: Added .github/workflows/build-apk.yaml to automate the Android APK build process.
  • Capacitor Configuration:
    • Added @capacitor/cli dependencies and created capacitor.config.ts.
    • Enabled HTTP/cleartext traffic and mixed content support to connect to the local server (Termux code-server backend).
  • Placeholder & Manifest Reference:
    • Added www/index.html as the app's initial entry/placeholder UI.
    • Added AndroidManifest-changes.xml as a reference file for setting Android permissions and cleartext traffic.
  • Package Scripts: Added Capacitor scripts (npm run sync and npm run open).

How to Test

  1. Go to the Actions tab in GitHub and manually trigger the "Build MyCode APK" workflow (workflow_dispatch).
  2. Once the build completes successfully, download the APK from Artifacts, install it on an Android device, and test.

@bhawan-kavinda
bhawan-kavinda requested a review from a team as a code owner October 9, 2026 04:38
@code-asher

code-asher commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Cool idea to build an APK. Did you mean to open it as a PR? I see some branding changes so I just want to confirm.

I wonder though if this can actually work? Terminals, language servers, sockets, all sorts of things can get spawned or opened in the background. As near I can tell, we would have to include the plugin that uses nodejs-mobile which does not seem to support all the APIs we need: https://github.com/capawesome-team/nodejs-mobile/blob/main/doc_mobile/FAQ.md#are-all-nodejs-apis-supported-on-mobile

The latest version is also v18 while we need v24.

@bhawan-kavinda

Copy link
Copy Markdown
Author

Thanks for taking a look!

Yes, I meant to open this as a PR. The branding was left over from my own fork and I've removed it in the latest push. Everything now lives under ci/android/ with its own package.json, and the root package.json is untouched.

On whether it can work: the app doesn't embed code-server or Node.js, and it doesn't use nodejs-mobile. It is only a thin Capacitor WebView that loads http://127.0.0.1:8080. code-server itself runs as a normal process in Termux (via the existing Termux install path in docs/termux.md), so terminals, language servers, and sockets behave as they do on any Linux system. That also means the nodejs-mobile API gaps and its v18 limit don't apply, and code-server keeps running on Node 24 as the repo requires.

The tradeoff is that it isn't self-contained: users need Termux with code-server installed and running first. I've documented this in docs/android-webview.md and noted that password auth should stay enabled, since other apps on the device can reach localhost.

If you'd rather not carry the Capacitor project in this repo, I'm happy to trim this down to just the docs page.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

2 participants