Home >Backend Development >Golang >Can golang write Android?

Can golang write Android?

尚
Original
2020-03-19 14:00:585593browse

Can golang write Android?

Golang can write Android. There is a new library in golang called go.mobile, which contains Go for Android library tools.

In the readme of the go.mobile library, there is an introduction to setting up a development environment, but it is limited to early versions, and the build system integrated into the IDE is not yet available.

1. First you need Android SDK and NDK.

2. Then you need to add an environment variable: NDK_ROOT=$HOME/android/ndk-toolchain

3. Configure the NDK tool ndk/build/tools/make-standalone-toolchain.sh - platform=android-9 --install-dir=$NDK_ROOT

4. Install Go cross-compiler

hg clone https://code.google.com/p/go
cd go/src
CC_FOR_TARGET=$NDK_CC GOOS=android GOARCH=arm GOARM=7 ./make.bash

5. If you have installed GO before, it will be for computer platform by default. , so ARM is built here. That's probably what it means.

6. Add go/bin to the path environment variable

Using Go, you can develop two projects, one is the android JAVA code called to go, the other is written in pure Go APP, the second one provides open gl and complete golang development environment.

For more golang knowledge, please pay attention to the golang tutorial column on the PHP Chinese website.

The above is the detailed content of Can golang write Android?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn