Git Product home page Git Product logo

mobile's Introduction

Go support for Mobile devices

The Go mobile repository holds packages and build tools for using Go on Android.

This is early work and the build system is a bumpy ride. Building a binary for Android requires using a Go cross compiler and an external linker from the NDK.

For now, the easiest way to setup a build environment is using the provided Dockerfile:

docker pull golang/mobile

Get the sample applications.

go get -d golang.org/x/mobile/example/...

In your app directory under your $GOPATH, copy the following files from either the golang.org/x/mobile/example/basic or golang.org/x/mobile/example/libhello apps:

AndroidManifest.xml
all.bash
build.xml
jni/Android.mk
make.bash

Start with basic if you are writing an all-Go application (that is, an OpenGL game) or libhello if you are building a .so file for use from Java via gobind. Edit the files to change the name of your app.

To build, run:

docker run -v $GOPATH/src:/src golang/mobile /bin/bash -c 'cd /src/your/project && ./make.bash'

Note the use of -v option to mount $GOPATH/src to /src of the container. The above command will fail if the -v option is missing or the specified volume is not accessible from the container.

When working with an all-Go application, this will produce a binary at $GOPATH/src/your/project/bin/name-debug.apk. You can use the adb tool to install and run this app. See all.bash for an example.

--

APIs are currently very limited, but under active development. Package documentation serves as a starting point:

Contributions to Go are appreciated. See https://golang.org/doc/contribute.html.

mobile's People

Contributors

crawshaw avatar hyangah avatar rakyll avatar nigeltao avatar robpike avatar adg avatar dsymonds avatar minux avatar rsc avatar dmitshur avatar db47h avatar dopsilva avatar alexbrainman avatar gauthamt avatar gordonklaus avatar josharian avatar matloob avatar proullon avatar

Watchers

Arturo Filastò avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.