[mirror] Go on Mobile https://golang.org/x/mobile
Go to file
David Crawshaw 9bbfe1ee47 go.mobile/sprite/portable: fix sub-image zero bound bug in affine
Also, modify the affine test to share the test
image with the glimage test.

LGTM=nigeltao
R=nigeltao
CC=golang-codereviews
https://golang.org/cl/164400043
2014-11-01 07:48:58 -04:00
app go.mobile/gl/glutil: let Image.Draw draw non-axis-aligned quads. 2014-10-31 14:32:34 +11:00
bind go.mobile/bind/java: fix build 2014-09-12 10:53:03 -04:00
cmd/gobind go.mobile/cmd/gobind: newline after printing errors 2014-08-12 14:29:18 -04:00
event go.mobile/event: types for user input events, starting with touch 2014-09-09 20:54:51 -04:00
example go.mobile/f32: add a f32.Bytes function. 2014-10-29 09:19:38 +11:00
f32 go.mobile/f32: add a f32.Bytes function. 2014-10-29 09:19:38 +11:00
geom go.mobile/geom: consolidate two small files into one. 2014-10-29 09:18:41 +11:00
gl go.mobile/gl/glutil: take advantage of new degree of freedom in test 2014-11-01 07:48:07 -04:00
sprite go.mobile/sprite/portable: fix sub-image zero bound bug in affine 2014-11-01 07:48:58 -04:00
testdata go.mobile/gl/glutil: take advantage of new degree of freedom in test 2014-11-01 07:48:07 -04:00
.hgignore .hgignore: add comment setting policy 2013-12-20 16:28:21 -08:00
AUTHORS go.empty: prototype for new subrepository 2012-01-25 14:45:13 -05:00
CONTRIBUTORS go.empty: prototype for new subrepository 2012-01-25 14:45:13 -05:00
Dockerfile go.mobile: copy the local version of go.mobile instead of downloading from the net. 2014-10-17 13:07:55 -04:00
LICENSE LICENSE: add 2012-03-17 15:20:58 +11:00
PATENTS go.empty: add PATENTS file to the subrepo. 2012-04-16 11:24:04 +10:00
README go.mobile/README: update libhello instructions 2014-09-17 18:12:08 -04:00
codereview.cfg codereview: switch defaultcc to golang-codereviews 2013-12-20 10:57:06 -05:00

README

The go.mobile repository holds libraries and build tools for Go on Android.

This is early stage work. The build system integration is not ready.
For now,

1. Install the Android SDK, either standalone or via Android Studio.

2. Install the Android NDK.

3. Pick a home for the standalone NDK toolchain and set an environment variable:
	NDK_ROOT=$HOME/android/ndk-toolchain

4. Confiure the NDK toolchain:
	ndk/build/tools/make-standalone-toolchain.sh \
		--platform=android-9 --install-dir=$NDK_ROOT

5. Install a Go cross-compiler from the unstable development branch:
	hg clone https://code.google.com/p/go
	cd go/src
	CC_FOR_TARGET=$NDK_CC GOOS=android GOARCH=arm GOARM=7 ./make.bash

   More details about installing from source are available at
   https://golang.org/doc/install/source.

6. Use the Go tool installed in the go/bin created above.
   For simplicity, put it on your path.

From here, there are two kinds of Android projects you can build,
Android apps written in Java with Go libraries, and Android apps
built entirely in Go. The first lets you use standard Android UI
libraries from Java, the second gives you only OpenGL, but an
entirely Go development environment.


Go library in an Android app - via ant/build.xml
-------------

Apps are written in Java, developed using the standard Android
tools, that include a Go library for added functionality. There is an
example of such a library in go.mobile/example/libhello.

Use the all.bash script in the libhello directory to build and run it.
More details on the build process are in libhello/README.


Go library in an Android app - via gradle
-------------

Coming soon.

For now, create an app in Android Studio, build the .so file in the
same way it is in the ant/build.xml examples and copy it into
YourApp/src/main/jniLibs/armeabi/libgojni.so.


Go Android apps (games)
-------------

Go Android apps are built on top of the NDK's NativeActivity. These apps
are written entirely in Go. An example of such an app, with touch events
and OpenGL, is in go.mobile/example/basic.

To build and deploy the app to the device currently attached to adb,
use the all.bash script in the example's directory. It requires
ndk-build, ant, and adb on your PATH.

APIs are currently very limited, but under active development.

To submit changes to this repository, see http://golang.org/doc/contribute.html.