The android-go project provides a platform for writing native Android apps in Go programming language.

Overview

android-go Go Report Card Lines of Code

The android-go project aims to provide a platform (namely an SDK) for writing native Android apps in Go programming language. All things here were designed to be less coupled as possible, thus maintaining a great level of flexibility while keeping things simple and easy to use. The approach and tools are different from gomobile, please distinguish them apart.

The project was one of the best Go Newsletter items of 2016. In this final issue of the year, they look back at the most popular Go news and links of 2016. 🌟

❗️ Important! Please see cmd/android-project utility that replaces the original android from SDK that has been stripped in latest SDK releases. All example Makefiles were updated, I advise you to do the same rather than stick to old SDK versions.

Project structure

android GoDoc

Package android provides Go bindings for the Android NDK API. They've been automatically generated by c-for-go using the official NDK headers from android-23 platform. Keep in mind that different NDK platforms may implement different sets of API available, thus some of features used by this binding may not be available in older versions of platform. But I tested with the android-21 toolchain and got no issues. Some files, like android/sensors.go for example, have been written by hand to expose some features that CGO does not handle well.

This package allows to write code that works directly with NDK API, bypassing all the CGO bookkeeping and boilerplate bloat in your code. But safety is strictly advised. There is also a JNI calling mechanism that allows easy interactions with Java VM and exposes the full potential of Android SDK! See android/jni_util.go for example of toggling Android keyboard and other JNI-based utils.

Example usages: app/queue.go, example, example-egl, nk-android.

cmd/android-project

Tool android-project is a simple replacement for infamous android util from Android SDK, prior to Android SDK Tools Revision 25.3.0 (March 2017) release when they dropped that util abruptly and got back a stripped version later. Needs to be installed first:

go get github.com/xlab/android-go/cmd/android-project

app GoDoc

Package app implements a NativeActivity glue layer required to properly handle the startup process and the native activity events. Import this package into your Go application to make it Android-compatible. Some pieces required for a proper main.main trampoline have been borrowed from gomobile, the absolute minimum to get this stuff invokable as a native activity. Most of the code in this package provides wrappers around NativeActivity event callbacks.

Example usages: example, example-egl, nk-android.

egl GoDoc

Package egl provides Go bindings for EGL API. They've been automatically generated by c-for-go using the official NDK headers from android-23 platform. All functions have their reference to the offical Khronos documentation. Some files, like egl/errors.go for example, have been written by hand to expose some features that would make it more idiomatic in the Go world.

Examples of usage in conjuction with the android package: example-egl, nk-android.

gles GoDoc

Package gles provides Go bindings for the OpenGL ES v1 API. They've been automatically generated by c-for-go using the official NDK headers from android-23 platform. All functions have their reference to the offical documentation.

Example of usage in conjuction with the android package: example-egl.

gles2 GoDoc

Package gles2 provides Go bindings for the OpenGL ES v2 API. They've been automatically generated by c-for-go using the official NDK headers from android-23 platform. All functions have their reference to the offical documentation.

Example of usage in conjuction with the android package: nk-android.

gles3 GoDoc

Package gles3 provides Go bindings for the OpenGL ES v3 API. They've been automatically generated by c-for-go using the official NDK headers from android-23 platform. All functions have their reference to the offical documentation.

Example of usage in conjuction with the android package: nk-android.

gles31 GoDoc

Package gles31 provides Go bindings for the OpenGL ES v3.1 API. They've been automatically generated by c-for-go using the official NDK headers from android-23 platform. All functions have their reference to the offical documentation. The OpenGL ES computing API is supported.

Examples

Refer the example links to get more info about them.

There are three examples. The first example is a template app showing how to create and build an Android application using the absolute minimum of code and boilerplate. It also shows the primitives of an activity and how to handle activity events, there is no visual part, so be ready to read the lines from the ADB logcat. If this one works correctly on your device, my congratulations. If not, please open an issue.

The example-egl leverages all three packages together: android, egl and of course gles (OpenGL ES 1.0) to create an visual app that animates its color based on the accelerometer values. It also reads input events such as key events and multitouch motion events (with pressure, if supported by the device), you can check these events in the ADB logcat. Please see the video of the expected behaviour:

Golang + EGL/GLES App on Android

And recently I took nuklear package and implemented a few backends in Go, including two for Android that initialize OpenGL ES 2 or ES 3 context using android, egl, gles2 and gles3 packages. They also responsible for handling touch and other input events. So now it is possible to create GUI apps for Android, see nk-android for an example Nuklear GUI app.

Nuklear GUI App written in Golang runs on Android

Android keyboard toggling video.

On existing tools or why not just use Gomobile

TL;DR it's a "three wheel bicycle" in terms of hacking flexibility. Conversely, this project tries to fill the niche by providing a platform that is minimal as possible and respects the bleeding-edge features such as OpenGL ES 3.1, ES 3.2 and of course Vulkan API.

GoMobile has different aims and motivation with a lot of implications. First of all, it has been grown as a bootstrap-script. That's it: a tool with a lot of hardcoded logic that helped to popularize Go on mobile platforms. Still provides a simple way to start building Android and iOS apps in no time, without diving deeply into any of the platform-specific complications. It provides a lot of wrappers and helpers that abstract all the platform-related boilerplate and logic away, making your apps look the same on any platform: Android, iOS, PC (Linux/OS X/Windows).

Also, considering that binding feature of GoMobile, it's a good option to use when you already have lots of Java/Obj-C code and want to integrate some of Go libs into the project. The tool is mostly for experienced mobile developers who just want to try Go sometimes. They provide a framework that hides platform details, but they also may be to restrictive and limited due to this and can't be used for crazy experimenting stuff.

An example: for Android developent, gomobile defaults to r10 SDK with android-15 stripped-down NDK, there is a lot of code written to automate this process and there is no way to override this environment, even by rewriting a lot of gomobile bootstrapping code. It's a great mess. I wasted too much time trying to switch to the r12-beta1 SDK and the android-23 NDK platform. Instead of providing a good document how to build the Go-based apps and incorporate them into any of the existing development process, GoMobile project introduces tons of hardcoded scripts.

Contributing

Feel free to share bugs, I expect a lot of weird cases. Please also share this project in social networks so more people would know how to write Go apps for Android that are not limited.

License

All the code except when stated otherwise is licensed under the MIT license.

Issues
  • Switch to gradle based build and add AssetReader

    Switch to gradle based build and add AssetReader

    I switched the simple example to the new build system. I also moved the example into a new examples folder (examples/minimal), to keep the examples separated from the library, while allowing us to reuse the build-script (examples/build-android.sh). The root directory is already a bit cluttered anyway and I want to add at least one more example (test app for asset code).

    Some of the documentation is a bit rough around the edges, but overall this build process is a lot smoother and requires fewer prerequisites. You don't even need to install the sdk anymore, since gradle and the sdk command line tools install everything you need automatically.

    The other examples should be trivial to convert, but I don't have time for that right now. Asset code updates and test app will follow shortly.

    This PR is mostly for comments for now. Let me know if you want me to change anything, that makes my life a bit easier than merging back and forth between repos, since I'll be working on the example folder. I'll update the PR with more asset stuff and an example for testing soon.

    opened by FlorianUekermann 11
  • Building Android-go in Android Open Source Project (AOSP)

    Building Android-go in Android Open Source Project (AOSP)

    How can we build android-go in Android Open Source Project (AOSP) for android marshmallow 6.0. Can you please help me with the steps for it. And after building Android-Go, will it generate JAR file so that other application can use this?

    opened by ssmumbai07 9
  • EGL bug. Opengl ES version Mismatch

    EGL bug. Opengl ES version Mismatch

    I am trying to Port Nanovgo example to Android using andrioid-go and EGL

    I modified Nanovgo to support GLES2 library from https://github.com/xlab/android-go/tree/master/gles2 , see modified version here nanovgo-gles

    func init() {
    	app.SetLogTag("GolangExample")
    	// Initialise gl bindings using the current context.
    	// err := gl.Init()
    	// if err != nil {
    	// 	log.Fatalln("gl.Init:", err)
    	// }
    }
    
    func main() {
    	log.Println("NativeActivity has started ^_^")
    	log.Printf("Platform: %s %s", runtime.GOOS, runtime.GOARCH)
    	nativeWindowEvents := make(chan app.NativeWindowEvent)
    	var displayHandle *egl.DisplayHandle
    	ctx, err := nanovgo.NewContext(0)
    	if err != nil {
    		panic(err)
    	}
    
    	//demoData = LoadDemo(ctx)
    	app.Main(func(a app.NativeActivity) {
    		a.HandleNativeWindowEvents(nativeWindowEvents)
    		a.InitDone()
    		for {
    			select {
    			case event := <-a.LifecycleEvents():
    				switch event.Kind {
    				case app.OnCreate:
    					log.Println(event.Kind, "handled")
    				default:
    					log.Println(event.Kind, "event ignored")
    				}
    			case event := <-nativeWindowEvents:
    				switch event.Kind {
    				case app.NativeWindowRedrawNeeded:
    					a.NativeWindowRedrawDone()
    					draw(displayHandle, ctx)
    					log.Println(event.Kind, "handled")
    				case app.NativeWindowCreated:
    					expectedSurface := map[int32]int32{
    						egl.SurfaceType: egl.WindowBit,
    						egl.RedSize:     8,
    						egl.GreenSize:   8,
    						egl.BlueSize:    8,
    					}
    					if handle, err := egl.NewDisplayHandle(event.Window, expectedSurface); err != nil {
    						log.Fatalln("EGL error:", err)
    					} else {
    						displayHandle = handle
    						log.Printf("EGL display res: %dx%d", handle.Width, handle.Height)
    					}
    					initGL()
    				case app.NativeWindowDestroyed:
    					displayHandle.Destroy()
    				default:
    					log.Println(event.Kind, "event ignored")
    					//demoData.FreeData(ctx)
    				}
    			}
    		}
    	})
    }
    
    func initGL() {
    	gl.Enable(gl.BLEND)
    	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
    	gl.Enable(gl.CULL_FACE)
    	gl.Disable(gl.DEPTH_TEST)
    }
    
    func draw(handle *egl.DisplayHandle, ctx *nanovgo.Context) {
    	fmt.Println("draw")
    	//fps := perfgraph.NewPerfGraph("Frame Time", "sans")
    
    	//t, _ := fps.UpdateGraph()
    
    	pixelRatio := float32(handle.Width) / float32(handle.Height)
    
    	gl.Viewport(0, 0, int32(handle.Width), int32(handle.Height))
    	fmt.Println("view port")
    
    	gl.ClearColor(0, 0, 0, 0)
    	fmt.Println("clear color")
    
    	gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)
    
    	ctx.BeginFrame(int32(handle.Width), int32(handle.Height), pixelRatio)
    	fmt.Println("begin frame")
    
    	demo.RenderDemo(ctx, 0, 0, 300, 600, 0, false, &demo.DemoData{})
    
    	//fps.RenderGraph(ctx, 5, 5)
    
    	ctx.EndFrame()
    
    	//gl.Enable(gl.DEPTH_TEST)
    
    	//glfw.PollEvents()
    
    	handle.SwapBuffers()
    
    }
    

    demo.go :

    func RenderDemo(ctx *nanovgo.Context, mx, my, width, height, t float32, blowup bool, data *DemoData) {
    	// Widgets
    	drawWindow(ctx, "Widgets `n Stuff", 50, 50, 300, 400)
    	var x float32 = 60.0
    	var y float32 = 95.0
    	fmt.Println("Draw Window")
    	drawSearchBox(ctx, "Search", x, y, 280, 25)
    	y += 40
    	fmt.Println("Draw Search")
    	drawDropDown(ctx, "Effects", x, y, 280, 28)
    	//popy := y + 14
    	y += 45
    	fmt.Println("Draw DropDown")
    	// Form
    	drawLabel(ctx, "Login", x, y, 280, 20)
    	y += 25
    	fmt.Println("Draw Label")
    	drawEditBox(ctx, "Email", x, y, 280, 28)
    	y += 35
    	fmt.Println("Draw Edit Box")
    	drawEditBox(ctx, "Password", x, y, 280, 28)
    	y += 38
    	fmt.Println("Draw Password")
    	drawCheckBox(ctx, "Remember me", x, y, 140, 28)
    	fmt.Println("Draw  Checkbox")
    	drawButton(ctx, IconLOGIN, "Sign in", x+138, y, 140, 28, nanovgo.RGBA(0, 96, 128, 255))
    	y += 45
    	fmt.Println("Draw Button")
    
    	// Slider
    	drawLabel(ctx, "Diameter", x, y, 280, 20)
    	y += 25
    	drawEditBoxNum(ctx, "123.00", "px", x+180, y, 100, 28)
    	drawSlider(ctx, 0.4, x, y, 170, 28)
    	y += 55
    
    	drawButton(ctx, IconTRASH, "Delete", x, y, 160, 28, nanovgo.RGBA(128, 16, 8, 255))
    	drawButton(ctx, 0, "Cancel", x+170, y, 110, 28, nanovgo.RGBA(0, 0, 0, 0))
    
    	fmt.Println("finished rendering")
    	// Thumbnails box
    	//drawThumbnails(ctx, 365, popy-30, 160, 300, data.Images, t)
    }
    

    BUG:

    i am getting a blank screen with these errors

    06-08 11:37:00.885 23648-23666/? I/GolangExample: NativeActivity has started ^_^
    06-08 11:37:00.885 23648-23666/? I/GolangExample: Platform: android arm
    06-08 11:37:00.887 23648-23666/? I/GolangExample: Shader shader/vert error:
    06-08 11:37:00.888 23648-23667/? I/GolangExample: onCreate handled
    06-08 11:37:00.890 23648-23666/? I/GolangExample: onStart event ignored
    06-08 11:37:00.893 23648-23666/? I/GolangExample: onResume event ignored
    06-08 11:37:00.894 23648-23648/? D/ActivityThread: EYE startEyeVerifyBroadcast packagename=com.go_android.minimal; ClassName=android.app.NativeActivity
    06-08 11:37:00.903 23648-23648/? V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = null, this = [email protected][],statusBarBackground visible =false,statusColor: 0xff000000->
    06-08 11:37:00.919 23648-23648/? D/WindowClient: Add to mViews: [email protected][NativeActivity], this = [email protected]
    06-08 11:37:00.934 23648-23648/? V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = ViewRoot{5b9d95c com.go_android.minimal/android.app.NativeActivity,ident = 0}, this = [email protected][NativeActivity],statusBarBackground visible =false,statusColor: 0xff000000->
    06-08 11:37:00.968 23648-23648/? I/lulingjie--screenshot--observer--: observer is [email protected][NativeActivity]
    06-08 11:37:00.994 23648-23648/? V/InputMethodManager: onWindowFocus: null softInputMode=272 first=true flags=#10100
    06-08 11:37:01.027 23648-23666/? D/Surface: Surface::setBuffersUserDimensions(this=0xe663a000,w=0,h=0)
    06-08 11:37:01.040 23648-23666/? D/Surface: Surface::connect(this=0xe663a000,api=1)
    06-08 11:37:01.042 23648-23666/? W/libEGL: [ANDROID_RECORDABLE] format: 2
    06-08 11:37:01.047 23648-23666/? D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000
    06-08 11:37:01.051 23648-23666/? I/GolangExample: EGL display res: 640x1070
    06-08 11:37:01.052 23648-23664/? I/GolangExample: draw
    06-08 11:37:01.052 23648-23664/? I/GolangExample: view port
    06-08 11:37:01.052 23648-23664/? I/GolangExample: clear color
    06-08 11:37:01.066 23648-23666/? D/GraphicBuffer: register, handle(0xe91913c0) (w:640 h:1070 s:640 f:0x2 u:0x000b00)
    06-08 11:37:01.068 23648-23664/? I/GolangExample: begin frame
    06-08 11:37:01.068 23648-23664/? I/GolangExample: Draw Window
    06-08 11:37:01.068 23648-23664/? I/GolangExample: Draw Search
    06-08 11:37:01.069 23648-23664/? I/GolangExample: Draw DropDown
    06-08 11:37:01.069 23648-23664/? I/GolangExample: Draw Label
    06-08 11:37:01.069 23648-23664/? I/GolangExample: Draw Edit Box
    06-08 11:37:01.069 23648-23664/? I/GolangExample: Draw Password
    06-08 11:37:01.069 23648-23664/? I/GolangExample: Draw  Checkbox
    06-08 11:37:01.070 23648-23664/? I/GolangExample: Draw Button
    06-08 11:37:01.070 23648-23666/? D/MALI: gles_state_set_error_internal:75: [MALI] GLES ctx: 0xa6680008, error code:0x502
    06-08 11:37:01.070 23648-23666/? D/MALI: gles_state_set_error_internal:76: [MALI] GLES error info: OpenGL ES API version mismatch
    
    opened by darmie 5
  • NativeActivity.AssetManager is nil

    NativeActivity.AssetManager is nil

    The AssetManager field of the android.NativeActivity returned by app.NativeActivity.NativeActivity() is nil.

    I'm building for API 24 with: export CGO_CFLAGS="-march=armv7-a" export GOOS=android export GOARCH=arm export GOARM=7

    The device is a Pixel XL

    opened by FlorianUekermann 5
  • Exposing golang direct to Flutter

    Exposing golang direct to Flutter

    Its all explained here: https://github.com/flutter/flutter/issues/7053

    Basically at the moment if you want to use golang with flutter so need to write Java and Objective C wrappers. I have been doing it this way using gomobile bind and then writing wrappers. Quite painful and high latency.

    So many cpp programmers have been asking the Flutter Team for direct calls between cpp and flutter, and the Flutter team are have listened and are exposing it.

    SO i think think that maybe android-go and ios-go would fit in their well.

    Also i noticed that already have FlatBuffers exposed between Dart and cpp and golang. https://github.com/dnfield/flatbuffers/blob/master/samples/sample_binary.go.

    opened by ghost 3
  • App: Add asset streaming

    App: Add asset streaming

    App should offer something like GetAssetReader(name string) io.ReadCloser to allow streaming large assets. The NDK functions work like that way anyway. See #7 for why this may not be trivial.

    opened by FlorianUekermann 3
  • Question about integration.

    Question about integration.

    Sorry to ask general questions but I have been using gomobile and noticed the android and iOS projects your working on. It looks like a great approach and I want to ask a few questions in relation to my needs.

    My GUI is web based using gopherjs with golang backend. The backend also goes on the mobiles with a websockets RPC between the GUI and backend all fully strongly typed due to gopherjs.

    So here is what I would need.

    1. Need webview. To boot the GUI.

    2. Need RPC over web sockets.

    When I use gomobile, i have to write all the RPC code in java and objective C, and then the golang code & web code uses them as a conduit.

    But perhaps with the xlab approach I can write more in golang ?

    opened by ghost 3
  • Allow apps to handle the Android

    Allow apps to handle the Android "back" button.

    Rough patch to allow apps to handle the "back" button without Android closing the app. This should be user-configurable but not sure on how you would like to implement this as app/handleEvents() does not keep a pointer to the nativeActivity struct where this configuration would logically be maintained.

    opened by gmp216 2
  • gles2 runtime error: cgo argument has Go pointer to Go pointer

    gles2 runtime error: cgo argument has Go pointer to Go pointer

    I am trying to port nanovgo to android using android-go

    I am trying to pass vertices []float32 data into gl.BufferData but I am getting a runtime error.

    gl.BufferData(gl.ARRAY_BUFFER, len(b), unsafe.Pointer(&vertexes), gl.STREAM_DRAW)

    06-05 12:22:17.041 32181-0/com.go_android.minimal E/Go: panic: runtime error: cgo argument has Go pointer to Go pointer
    06-05 12:22:17.041 32181-0/com.go_android.minimal E/Go: goroutine 7 [running]:
    06-05 12:22:17.041 32181-0/com.go_android.minimal E/Go: github.com/xlab/android-go/gles3.BufferData.func1(0x8892, 0x3940, 0xb7ae2258, 0x88e0)
    06-05 12:22:17.041 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/xlab/android-go/gles3/gles3.go:110 +0x3c
    06-05 12:22:17.041 32181-0/com.go_android.minimal E/Go: github.com/xlab/android-go/gles3.BufferData(0x8892, 0x3940, 0xb7ae2258, 0x88e0)
    06-05 12:22:17.041 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/xlab/android-go/gles3/gles3.go:110 +0x34
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: github.com/shibukawa/nanovgo.(*glParams).renderFlush(0xb7a5e258)
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/shibukawa/nanovgo/gl_backend.go:584 +0x188
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: github.com/shibukawa/nanovgo.(*Context).EndFrame(0xb7abe090)
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/shibukawa/nanovgo/nanovgo.go:169 +0x28
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: main.draw(0xb7abe090)
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/darmie/nanovg-android/main.go:86 +0x180
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: main.main.func1(0xd7cf0f00, 0xd7d602a8)
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/darmie/nanovg-android/main.go:53 +0x35c
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: github.com/xlab/android-go/app.Main(0xb7a7ffc4)
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/xlab/android-go/app/app.go:86 +0x38
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: main.main()
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/darmie/nanovg-android/main.go:37 +0x17c
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: github.com/xlab/android-go/app/internal/callfn.CallFn(0xd7c6d39c)
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/xlab/android-go/app/internal/callfn/callfn_arm.s:10 +0x18
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: created by github.com/xlab/android-go/app.callMain
    06-05 12:22:17.042 32181-0/com.go_android.minimal E/Go: 	/Users/damilare/go/src/github.com/xlab/android-go/app/app.go:50 +0x2e4
    06-05 12:22:17.043 32181-32208/com.go_android.minimal A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 32208 (android.minimal)
    
    opened by darmie 1
  • Notifications using other api

    Notifications using other api

    I like how this project has made the different parts granular. I am using https://github.com/therecipe/Qt to make android apps, I want to use this in conjunction, what do I need from here to add app notifications to my app? Thanks

    opened by amlwwalker 1
  • example-egl build fails

    example-egl build fails

    I have followed the instructions as per the readme, but I can't build the example app.

    I also am having problems building the nk-android example. I must have something missing in my environment. Any help appreciated.

    The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
    :android:prepareToolchain
    Preparing toolchains for ABIs: armeabi-v7a x86 Android API: 26
    Using existing standalone toolchain for arch: x86
    Using existing standalone toolchain for arch: arm
    :android:buildGo
    Build Go sources using ABIs: armeabi-v7a x86 Android API: 26
    Cleaning output dir build_go/output
    ++ pwd
    + CURRENT_DIR=/home/simulator/go/src/github.com/xlab/android-go/example-egl
    + CC=/home/simulator/go/src/github.com/xlab/android-go/example-egl/android/build_go/toolchain/arm/bin/arm-linux-androideabi-gcc
    + CXX=/home/simulator/go/src/github.com/xlab/android-go/example-egl/android/build_go/toolchain/arm/bin/arm-linux-androideabi-g++
    + CGO_ENABLED=1
    + CGO_CFLAGS=-march=armv7-a
    + GOOS=android
    + GOARCH=arm
    + GOARM=7
    + go build -i -pkgdir /home/simulator/go/src/github.com/xlab/android-go/example-egl/android/build_go/output/armeabi-v7a -buildmode=c-shared -o android/src/main/jniLibs/armeabi-v7a/libgomain.so
    # runtime/cgo
    _cgo_export.c:2:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    :android:buildGo FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':android:buildGo'.
    > Process 'command '../bash_script/build_go.sh'' finished with non-zero exit value 2
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 3s
    2 actionable tasks: 2 executed
    
    
    

    Any help appreciated. I have written a nuklear app, and it runs on Linux/FreeBSD I am trying to get it to run on Android.

    opened by wilyarti 0
  • Binding to Fyne UI framework

    Binding to Fyne UI framework

    Fyne UI framework has recentely reached 1.0 and seems more pure GO than Nuklear. It has full screen in the demo. It could be nice to team up efforts with Fyne, to release a nice android interface.

    https://github.com/fyne-io/fyne

    They are planning nice features usefull for Smartphones apps : https://github.com/fyne-io/fyne/issues/4

    opened by hubyhuby 2
  • llvm/prebuilt/darwin-x86_64/bin/clang: No such file or directory

    llvm/prebuilt/darwin-x86_64/bin/clang: No such file or directory

    I'm a Go developer and new to Android and I'm trying to find out whether I can use android-go to build an Android Things app. I am trying to build the minimal example with go1.11 on macOS 10.14 (Mojave) for API version 27.

    I'm getting the following output. Any help is greatly appreciated :)

    $ ANDROID_HOME=~/android-sdk ../build-android.sh
    + : 27
    + : /Users/frank/android-sdk
    + : /Users/frank/android-sdk//ndk-bundle
    + export ANDROID_API ANDROID_HOME ANDROID_NDK_HOME
    + /Users/frank/android-sdk/tools/bin/sdkmanager --update
    [=======================================] 100% Computing updates...
    + /Users/frank/android-sdk/tools/bin/sdkmanager ndk-bundle
    [=======================================] 100% Computing updates...
    + rm -rf android/toolchain
    + /Users/frank/android-sdk//ndk-bundle/build/tools/make_standalone_toolchain.py --install-dir=android/toolchain --arch=arm --api=27 --stl=libc++
    + mkdir -p android/app/src/main/jniLibs/armeabi-v7a
    + GOOS=android
    + GOARCH=arm
    + GOARM=7
    + go get -d
    + CC=/Users/frank/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/arm-linux-androideabi-gcc
    + CXX=/Users/frank/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/arm-linux-androideabi-g++
    + CGO_ENABLED=1
    + CGO_CFLAGS=-march=armv7-a
    + GOOS=android
    + GOARCH=arm
    + GOARM=7
    + go build -i -buildmode=c-shared -o android/app/src/main/jniLibs/armeabi-v7a/libgomain.so
    # runtime/cgo
    /Users/frank/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/arm-linux-androideabi-gcc: line 2: /Users/frank/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/../../../../llvm/prebuilt/darwin-x86_64/bin/clang: No such file or directory
    /Users/frank/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/arm-linux-androideabi-gcc: line 2: exec: /Users/frank/src/github.com/xlab/android-go/examples/minimal/android/toolchain/bin/../../../../llvm/prebuilt/darwin-x86_64/bin/clang: cannot execute: No such file or directory
    
    opened by magiconair 6
  • Error

    Error "Sorry com.go_android.minimal stopped"

    @xlab I got minimal app installed on the android device but when I start the app error message appears: "Sorry com.go_android.minimal stopped"

    Can anyone advice, please ?

    opened by TechComSpot 0
  • android project update is not working on debian

    android project update is not working on debian

    1. I create go workspace.
    2. Install go 1.10.2 version.
    3. Dowload Android SDK (Command line tools only) for linux.
    4. Extract archive
    5. Set ANDROID_HOME variable in bashrc file.
    6. Run go get github.com/xlab/android-go/cmd/android-project
    7. Run android project update

    Got:

    screenshot at 2018-05-31 14-22-55

    Please HELP!

    opened by TechComSpot 0
  • Example link with the info how to set up environment for Android Demo App is broken

    Example link with the info how to set up environment for Android Demo App is broken

    Hi. I did $ apt install xorg-dev $ go get github.com/golang-ui/nuklear/nk $ go get -tags opengl2 github.com/golang-ui/nuklear/nk

    but when came to example link found that it's broken.

    Can anyone share the correct link how to set environment for running Android Demo App, please?

    Thank you.

    opened by TechComSpot 0
Owner
Max Kupriianov
Principal Engineer @InjectiveLabs
Max Kupriianov
Image resizing for the Go programming language with common interpolation methods

This package is no longer being updated! Please look for alternatives if that bothers you. Resize Image resizing for the Go programming language with

null 1 Dec 14, 2021
General purpose library for reading, writing and working with OpenStreetMap data

osm This package is a general purpose library for reading, writing and working with OpenStreetMap data in Go (golang). It has the ability to read OSM

Paul Mach 220 Aug 1, 2022
A toy ray tracer to practice writing go.

pbrt-go A toy ray tracer written to practice writing go. Slowly working towards an implementation based on the excellent 3rd edition of PBRT, because

Dan Bolan 0 Oct 19, 2021
Build apps for pixel-based displays.

Pixlet Pixlet is an app runtime and UX toolkit for highly-constrained displays. We use Pixlet to develop applets for Tidbyt, which has a 64x32 RGB LED

Tidbyt 377 Aug 2, 2022
Super fast static photo and video gallery generator (written in Go and HTML/CSS/native JS)

fastgallery Fast static photo and video gallery generator Super fast (written in Go and C, concurrent, uses fastest image/video libraries, 4-8 times f

Toni Melisma 24 May 25, 2022
go chart is a basic charting library in native golang.

go-chart Package chart is a very simple golang native charting library that supports timeseries and continuous line charts. Master should now be on th

Will Charczuk 3.6k Aug 3, 2022
go library for image programming (merge, crop, resize, watermark, animate, ease, transit)

Result Terminal Code mergi -t TT -i https://raw.githubusercontent.com/ashleymcnamara/gophers/master/Facepalm_Gopher.png -r "131 131" -i https://raw.gi

Noel Yahan 178 Jul 29, 2022
A pair programming service using operational transforms

Leaps is a service for collaboratively editing your local files over a web UI, using operational transforms to ensure zero-collision synchronization a

Ashley Jeffs 724 Jul 16, 2022
p5 is a simple package that provides primitives resembling the ones exposed by p5js.org

p5 p5 is a simple package that provides primitives resembling the ones exposed by the p5/processing library. License p5 is released under the BSD-3 li

null 107 Jul 31, 2022
Package shapes provides an algebra for handling shapes

About Package shapes provides the algebra and machinery for dealing with the metainformation of shapes of a tensor. Why a shape package? The shape pac

Gorgonia 4 Jan 14, 2022
Provides a method to create thumbnails from provided images.

Thumbnail Generation Package for Go This package provides method to create thumbnails from provided images. Installation Use to go command: $ go get g

Matthew Jorgensen 1 Mar 12, 2022
Open-in-linear - A tool provides a shortcut to opening a linear issue in the desktop app or browser

This tool provides a shortcut to opening a linear issue in the desktop app or browser.

John Pedrie 1 Jan 25, 2022
Go cross-platform OpenGL bindings.

gl Package gl is a Go cross-platform binding for OpenGL, with an OpenGL ES 2-like API. It supports: macOS, Linux and Windows via OpenGL 2.1 backend, i

null 158 Jul 16, 2022
Go cross-platform glfw library for creating an OpenGL context and receiving events.

glfw Package glfw experimentally provides a glfw-like API with desktop (via glfw) and browser (via HTML5 canvas) backends. It is used for creating a G

null 75 Jul 23, 2022
A cross-platform tool to convert images into ascii art and print them on the console

A cross-platform tool to convert images into ascii art and print them on the console

Zoraiz Hassan 897 Jul 31, 2022
Go Language Library for SVG generation

SVGo: A Go library for SVG generation The library generates SVG as defined by the Scalable Vector Graphics 1.1 Specification (http://www.w3.org/TR/SVG

Anthony Starks 1.9k Jul 28, 2022
Avatar generation library for GO language

GOvatar GOvatar is an avatar generation library written in GO Install To install the library and command-line program, use the following: $ go get -u

Oleg Lobanov 509 Jul 29, 2022
A Go-language library for the automatic generation of image collages.

CollageCreator is a Go-language library for the automatic generation of image collages.

August Schwerdfeger 0 Jan 29, 2022
NanoVGo NanoVGNanoVGo is pure golang implementation of NanoVG. The same author maintains the NanoGUI.go project mentioned above.

NanoVGo Pure golang implementation of NanoVG. NanoVG is a vector graphics engine inspired by HTML5 Canvas API. DEMO API Reference See GoDoc Porting Me

Yoshiki Shibukawa 139 May 21, 2022