一次使用golang 编译android sdk 的记录

我发现这个我们需要安装的依赖特别特别多下面记录下我们前期需要安装的东西(我是在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 下载安装

gomobile 编译说明链接 

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=""

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值