Go for Android compilation guide

Source: Internet
Author: User
Tags docker run

In mid-December last year, GO has officially supported the Android platform! Although, at present, only preliminary support, the corresponding development is still tight shelomith drum in progress. But still can't resist the impulse to try one. The code of Go is now called through the JNI interface of Java, and the Code of Go will be compiled into so dynamic library, which will be included in the APK when compiling. below to see how to compile the Go code on the Android platform.


Download the code from the downloaded connection first:

Https://github.com/golang/mobile


Because the development environment of Go for Android is currently in trouble, the go for Android developer has provided us with a Docker image (Docker installation can refer to "Docker Usage Summary") and can be downloaded using the following command:

Docker Pull Golang/mobile


To run the mobile container:


Docker run-it--rm-v/home/my/go/mobile-master:/go_mobile Golang/mobile/bin/bash


This assumes that the path to the downloaded go for Android code is:/home/my/go/mobile-master, which will allude/home/my/go/mobile-master to the container's/go_mobile directory.


Next in $GOROOT/src/golang.org/x/create the/go_mobile symbol to connect the mobile


Mkdir-p $GOROOT/src/golang.org/xln-s/go_mobile $GOROOT/src/golang.org/x/mobile


Compile the Libhello sample code:

CD  $GOROOT/src/golang.org/x/mobile/example/libhello./make.bash


To connect to a device:
ADB Connect xx.xx.xx.xx

Installation:

ADB install bin/hello-debug.apk


The next step is to run.


Summary: Now go for Android only do the go code on the Android platform simple run, want to really use go on Android platform like game development, and so on, there is much work to do.

Go for Android compilation guide

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.