我发现这个我们需要安装的依赖特别特别多下面记录下我们前期需要安装的东西(我是在linux 环境开发的)下面记录下我安装的包。

1:golang 安装1.11 以上

2:gomobile  安装并并编译命令

go get  golang.org/x/mobile

3:android sdk 下载安装(这里需要安装java)note :在下载安装完毕后建议升级,来安装platform 下的api 文件否则会出现以下错误:Failed to find Platform SDK with path: platforms;android-19 下面的是android sdk 安装链接

https://blog.csdn.net/kongxingxing/article/details/82259240

4:android ndk 下载安装

https://github.com/golang/go/wiki/Mobile#tools

5: 编译为aar 文件的命令

gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello

具体的安装方法后期会补上

错误解决

gomobile: go [-e -json -compiled=true -test=false -export=false -deps=false -find=true 
-- ./wallet]: exit status 1: go: cannot find main module; see 'go help modules'

错误原因是gomobile 暂时不支持gomodules,所以编译的时候需要关闭GO111MODULE=""