golang gomobile 环境配置总结

1.安装Golang SDK。

2.临时关闭 gomod

export GO111MODULE=off

3.安装gobind工具

go get golang.org/x/mobile/cmd/gobind

如果安装失败的话需要手动编译源码:

1).clone gomobile 项目到gopath/src/golang.org/x/路径下。

git clone https://gitee.com/yznzhankun/mobile.git

2).clone golang.org/x/mod 项目到gopath/src/golang.org/x/下。

git clone https://gitee.com/yznzhankun/mod.git

3).clone golang.org/x/xerrors 项目到gopath/src/golang.org/x/下。

https://gitee.com/yznzhankun/xerrors.git
4).clone golang.org/x/tools 项目到gopath/src/golang.org/x/下
https://gitee.com/yznzhankun/tools.git

5).继续编译安装gobind

go get golang.org/x/mobile/cmd/gobind

4.编译安装gomobile

go get golang.org/x/mobile/cmd/gomobile

5.配置Android NDK

1).下载NDK

2).解压NDK,并将NDK解压文件后的Ndk根路径设置给名为ANDROID_NDK_HOME的环境变量。

6.初始化gomobile

gomobile init

声明:

文中提到的所有git仓库均为楼主同步官方源码而来,仅同步代码未作任何修改,同步时间为2020年3月5日11:00左右,主要目的是为了解决访问G站慢的问题。

你可能感兴趣的:(golang gomobile 环境配置总结)