gowebview

command module
v0.0.0-...-5c8971a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

gowebview

Tool to create an android application from an go http server package. The package must just set some endpoints.

This project is not active anymore, check out: https://github.com/Inkeliz/gowebview

prerequisites

download and install android sdk and ndk

gomobile: go get -u golang.org/x/mobile/...

set environment variables:

  • JAVA_HOME - where the javac is
  • ANDROID_HOME - android sdk path
  • ANDROID_NDK_ROOT - android ndk path

example http package that sets the '/' path:

package exampleserver

import "net/http"

func init() {
	//just add some endpoints to the server
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("hello"))
	})
	//or you can also use your favorite router and then paste it to http.DefaultServeMux
}

Check the ID of the target android API with $ $ANDROID_HOME/tools/android list target. It will be eg. 13.

Then go to the package directory and run:

$ gomobile init -ndk $ANDROID_NDK_ROOT
$ gowebview -target 13

gowebview creates an gradle project in build directory.

Go to the build directory and create your android apk:

$ cd build
$ ./gradlew build

You can now install your brand new android application:

$ adb install -r build/outputs/apk/build-debug.apk

Enjoy your awesome app:

screenshot

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL