Is It Possible To Convert My Go App Into An Android App

Hello, I write a app for windows, specifically a CLI app completely in Go. I would like to create an android application using the same code that I wrote for desktop. Is it possible to recycle my code and build it as a mobile app? How to proceed?

1 Like

When you say:

Do you mean you want an actual command-line application on Android? Like a terminal in the top half of the screen with a keyboard at the bottom, or do you mean that you want a more “Android-like” experience that does the same thing as your desktop app does?

1 Like

I would like similar to a terminal, command-line style

Can be any of the option, terminal or android-like experience. I just aim to create a mobile version.

Maybe this is helpful? Home · termux/termux-packages Wiki · GitHub

1 Like

It can be done using the Termux application on your Android.

It might be better to use Flutter and provide the same app for iOS at the same time, if feasible.

In my opinion, nothing is more confusing than Git because it appears to be a common practice there not explaining anything! I wonder why.

Self-contained binaries…

This feature even appeals to pure users of a Go app or tool. A Go main package compiles to a single, self-contained binary with no external dependencies. No shared libraries, no pre-installed runtime environments are required for running a Go binary. You just pick the compiled binary and push it to the target machine. Or pack int into a Docker container built FROM scratch. No OS libs required.

…and cross-compiling

As if single-binary was not cool enough already, Go even allows to cross-compile to different target operating systems and architectures without having to install an appropriate target-specific tool chain.

So if you write code on a macOS machine and want to run it on a Rasperry Pi, you just type

GOOS=linux GOARCH=arm go build

and you can push the resulting binary over to your Pi and run it right away.

This works also for OSes like AIX, Darwin (macOS), NetBSD, OpenBSD, Plan9, Windows, and more, and for architectures like 386,AMD64, ARM (32 and 64 bit), RISC-V, or WASM, to name just a few. If you have Go installed, type go tool dist list to get a list of all supported OS/architecture combinations.


1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.