golang gomobile 环境搭建
1. 安装Go语言SDK
https://www.golangtc.com/download
2. 配置系统变量这建立GOROOT和GOPATH两个目录,分别对应sdk所在目录与项目文件根目录
3. 输入go version 验证是否成功
4. 安装gomobile
1)cmd敲起命令(需要CMD翻墙)
go get golang.org/x/mobile/cmd/gomobile gomobile init
2)git clone https://github.com/golang/mobile,下载成功后改文件名为mobile, copy到$GOPATH/src/golang.org/x/
如果没有文件路径,自行创建
2.1)go build golang.org/x/mobile/cmd/gomobile,此时会在GOPATH/bin下面生成gomobile;
2.2)执行gomobile init, 会在GOPATH/bin下面生成gobind;
gomobile init执行不会报错,如果有问题,执行bind时会报错;
执行init后,执行gomobile version,查看是否成功:
将gomobile,gobind拷贝, sudo cp gomobile gobind /usr/local/go/bin;因为执行gomobile bind时,回去系统path里找gobind;
下载:AndroidNDK
- 选择符合的操作系统及位数的NDK包:https://developer.android.google.cn/ndk/downloads/index.html
- 解压,放到一个你记得住的目录
3) 尝试编译第一个Android apk安装包cmd命令:gomobile build -target=android golang.org/x/mobile/example/basic
如果提示 “No android NDK path is set“,需要以下代码指定NDK路径
gomobile init -ndk "你的AndroidNDK路径"
然后再编译,编译成功后会把编译后的APK(%GOPATH%\src)安装包放到CMD当前指向的目录中
最新文章
- Thinkphp源码分析系列(三)– App应用程序类
- 60-chmod 修改文件的权限
- 118. Pascal's Triangle
- 【BZOJ】3240: [Noi2013]矩阵游戏
- 为Windows 8新建工具栏模拟“开始菜单”
- hdu 4712 Hamming Distance 随机
- vs2012 Silverlight项目签名报错异常的处理方式
- BestCoder Round #75 解题报告
- python之数据库操作(sqlite)
- Arch安装详解
- 关于iOS开发中info.plist文件的解读
- WebService之CXF注解之四(测试类)
- 洛谷1196【NOI2002】题解
- Linux报错之ping: www.baidu.com: Name or service not known
- c#NPOI读取excel 比interop和Microsoft.Jet.OLEDB.4.0 之类 的好的多
- Linux 命令详解(七)Systemd 入门教程:命令篇
- 封装sqlhelper【一】
- UVa 11039 - Building designing 贪心,水题 难度: 0
- 关于hive的优化
- POJ 3468A Simple Problem with Integers(线段树区间更新)