1
1
Fork
You've already forked zop
0

WIP: Add proper Android app wrapping the zop AI CLI #7

Closed
Copilot wants to merge 5 commits from copilot/build-android-app into main
pull from: copilot/build-android-app
merge into: mutablecc:main
mutablecc:main
mutablecc:ui-screenshots
mutablecc:dependabot/go_modules/golang.org/x/image-0.38.0
mutablecc:feature/add-prompt-templates
mutablecc:feature/voice-output
mutablecc:feature/add-features-1
mutablecc:feature/add-new-ai-providers
mutablecc:feature/add-makefile-build
mutablecc:copilot/add-macos-arm64-build-target
mutablecc:copilot/fix-whisper-audio-capture-linux
mutablecc:copilot/add-tag-v0-3-1
mutablecc:copilot/fix-android-build-error
mutablecc:copilot/add-hardware-acceleration-android-build
mutablecc:copilot/fix-linux-amd64-and-android-builds
mutablecc:copilot/modify-release-workflow-manual-trigger
mutablecc:copilot/fix-linux-github-action-release
mutablecc:copilot/fix-build-error-github-action
mutablecc:copilot/port-go-whisper-android-app
mutablecc:copilot/add-copilot-instructions-file
mutablecc:copilot/fix-zop-command-input-errors
mutablecc:copilot/make-whisper-default-build
mutablecc:copilot/rename-project-to-zop
mutablecc:copilot/add-go-ai-cli-tool-pgpt
Copilot commented 2026年03月15日 10:06:26 +01:00 (Migrated from github.com)
Copy link

A CLI binary cross-compiled for GOOS=android cannot be launched as an Android app. This adds a proper APK built via gomobile bind + Gradle, with a native Java chat UI.

Go library (internal/zoplib/)

New gomobile-compatible package exposing a single function:

funcQuery(apiKey,baseURL,model,systemPrompt,userPromptstring)(string,error)

gomobile bind maps this to zoplib.Zoplib.query(...) in Java. Wraps go-openai (already a dependency). 5 mock-server unit tests cover success, system-prompt handling, server errors, and empty-choices.

Android app (android/)

Minimal Gradle project targeting API 21+, compileSdk 34:

  • MainActivity.java — scrollable conversation view + EditText/Button input; network calls on ExecutorService thread, UI updates via Handler(Looper.getMainLooper()); action-bar Settings dialog persists API key, base URL, model, and system prompt to SharedPreferences
  • ZopUnitTest.java — JVM unit tests for app-layer logic
  • app/libs/zoplib.aar is generated at build time (excluded from VCS)

CI/CD

  • android.yml (new) — runs go test ./internal/zoplib/, installs NDK via sdkmanager, runs gomobile bind, builds debug APK with Gradle 8.7 + AGP 8.3.2, runs Android JVM tests, uploads APK artifact
  • release.yml — new build-android job produces an unsigned release APK attached to GitHub Releases; removes the old GOOS=android CLI binary matrix entry (superseded)
  • test.yml — updated android job now runs go test ./internal/zoplib/ alongside the existing cross-compile checks

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.4-bin/1w5dpkrfk8irigvoxmyhowfim/gradle-8.4/lib/gradle-launcher-8.4.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.4-bin/1w5dpkrfk8irigvoxmyhowfim/gradle-8.4/lib/agents/gradle-instrumentation-agent-8.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.4 -o ux_amd64/vet (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

A CLI binary cross-compiled for `GOOS=android` cannot be launched as an Android app. This adds a proper APK built via `gomobile bind` + Gradle, with a native Java chat UI. ## Go library (`internal/zoplib/`) New `gomobile`-compatible package exposing a single function: ```go func Query(apiKey, baseURL, model, systemPrompt, userPrompt string) (string, error) ``` `gomobile bind` maps this to `zoplib.Zoplib.query(...)` in Java. Wraps `go-openai` (already a dependency). 5 mock-server unit tests cover success, system-prompt handling, server errors, and empty-choices. ## Android app (`android/`) Minimal Gradle project targeting API 21+, `compileSdk 34`: - **`MainActivity.java`** — scrollable conversation view + `EditText`/`Button` input; network calls on `ExecutorService` thread, UI updates via `Handler(Looper.getMainLooper())`; action-bar Settings dialog persists API key, base URL, model, and system prompt to `SharedPreferences` - **`ZopUnitTest.java`** — JVM unit tests for app-layer logic - `app/libs/zoplib.aar` is generated at build time (excluded from VCS) ## CI/CD - **`android.yml`** (new) — runs `go test ./internal/zoplib/`, installs NDK via `sdkmanager`, runs `gomobile bind`, builds debug APK with Gradle 8.7 + AGP 8.3.2, runs Android JVM tests, uploads APK artifact - **`release.yml`** — new `build-android` job produces an unsigned release APK attached to GitHub Releases; removes the old `GOOS=android` CLI binary matrix entry (superseded) - **`test.yml`** — updated `android` job now runs `go test ./internal/zoplib/` alongside the existing cross-compile checks > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `dl.google.com` > - Triggering command: `/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.4-bin/1w5dpkrfk8irigvoxmyhowfim/gradle-8.4/lib/gradle-launcher-8.4.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.4-bin/1w5dpkrfk8irigvoxmyhowfim/gradle-8.4/lib/agents/gradle-instrumentation-agent-8.4.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.4 -o ux_amd64/vet` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/peterwwillis/zop/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT TIPS --> --- 📍 Connect Copilot coding agent with [Jira](https://gh.io/cca-jira-docs), [Azure Boards](https://gh.io/cca-azure-boards-docs) or [Linear](https://gh.io/cca-linear-docs) to delegate work to Copilot in one click without leaving your project management tool.
peterwwillis (Migrated from github.com) reviewed 2026年03月15日 10:06:26 +01:00

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mutablecc/zop!7
Reference in a new issue
mutablecc/zop
No description provided.
Delete branch "copilot/build-android-app"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?