Code Monkey home page Code Monkey logo

android-go-mobile's Introduction

android-go-mobile - building go code for android in a container

Concept idea of this container

  • The container itself includes go, Android SDK, gomobile pre-initialized
  • The source code to build is mounted into the container via a docker volume (see $SRC_HOME in the example)
  • The build also defines the output of the build somwhere inside this mounted volume so that you can access the result from outside the container easily (see '-o myLib.aar' in the example).

License notes

This image is forked from https://github.com/moohoorama/android-go-mobile which by itself was forked from https://github.com/OpenPriv/android-go-mobile. Thanks for your work which helped a lot :)

Android, Go, and gomobile

This image was built for use with generic gomobile builds for Android.

This image includes:

  • based on Ubuntu 23.04
  • Android SDK, NDK, tools, and API version 32 at /usr/local/android-sdk
  • Go lang 1.21.1 at /usr/local/go
  • $GOPATH set to /workspace/go
  • A go directory with an initialized gomobile installed at /go

This image comes with gomobile checkedout and pre-initialized (time and space consuming). In order to install this pre-done work from the image into your Drone CI workspace (a docker volume mounted to /workspace), you will want your first pipeline step to be:

go-link:
  image: openpriv/android-go-mobile
  commands:
    - cp -as /go /workspace/go

cp -as recreates the directory structure from /go in /workspace/go but for each file, it just creates a symlink. This is the quickest and most efficient way to mirror the work supplied with the image into your workspace.

usage

Example how to build a .aar Android library usable in a standard Android app (e.g. with Android Studio).

	# do not use the :latest tag for production use to avoid broken build when the container is updated
	BUILD_IMAGE="turtletramp/android-gomobile:1.21.1"

	# (optional) pull latest build container (available on docker hub; or alternatively build it yourself locally)
	docker $BUILD_IMAGE
	# execute the build (SRC_HOME is the absolute path of th source code folder containing your go code; it get's mounted as a volume)
	SRC_HOME=`pwd`
	# the workdir specifies the folder inside the source directory that contains the final android library glue code
	docker run --rm -v $SRC_HOME:/workspace/src --workdir /workspace/src $BUILD_IMAGE gomobile bind -target android -v -x -o myLib.aar

For further details about gomobile please checkout the gomobile website/documentation.

android-go-mobile's People

Contributors

dballard avatar moohoorama avatar turtletramp avatar turtletrampom avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ibcjacky

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.