19

I have a go library that i want to run on android and use its methods in my android app. I could write the whole android app in go to make it easier to use this dependency. Is this possible? If so, how?

3
  • 4
    github.com/golang/mobile Commented Feb 26, 2015 at 21:08
  • The mobile stuff is targeting NDK apps like games, I think, so you lose access to Android's Java UI libraries and such. Gopher bradfitz made an Android app, the Camlistore uploader, that runs a Go program as a child process (and my understanding is that was tricky to do). In other words, progress is happening but you're limited in how you can use Go on Android as of today. Commented Feb 27, 2015 at 23:19
  • 1
    This is not accurate. You can call into Go from Java on Android. See the example app on github.com/golang/mobile/tree/master/example/libhello. Commented May 8, 2015 at 21:45

3 Answers 3

9

Golang support for mobile development has been steadily improving. Today it is even possible to build some simple all Go apps (depending on which features you need) as well as Go libraries. Please see https://go.dev/wiki/Mobile for more info.

UPDATE: In further improvement, libraries are being created to support even UI on mobile platforms. https://fyne.io provides rather robust set of features for mobile.

Sign up to request clarification or add additional context in comments.

1 Comment

The wiki for Go Mobile has moved to go.dev/wiki/Mobile - all information can be found there
6

Download Termux (Linux Emulator) from google play store and open it. Next, wait for it to perform an automatic download of its resources. After that operation, the run the following command: pkg install golang pkg install git

The git package is required when downloading golang packages. Eventually, you can test it by running (go) command.

Comments

3

You can use a Go library from Java when developing for Android with gobind (see this example in the gomobile repository). The biggest issue with this is integration into the build system.

For Go 1.5 things are getting better, but you'll have to wait for that.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.