请参考:http://www.cnblogs.com/ghj1976/p/5087049.html html
Mac 下命令行设置代理:android
export http_proxy=http://127.0.0.1:8787git
git config --global http.proxy http://127.0.0.1:8787
git config --global https.proxy https://127.0.0.1:8787 github
go get -u golang.org/x/mobile/cmd/gomobile golang
gomobile initapp
若是出现下面错误:iphone
$ gomobile init工具
gomobile: xcrun --show-sdk-path: exit status 1测试
xcrun: error: SDK "iphoneos" cannot be locatedui
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
则须要确保你安装了 XCode
我直接下载的的 Android Studio, 一步到位, 下载地址:
https://developer.android.com/sdk/installing/index.html?pkg=studio
Android Studio 的 Configure –》 SDK Manager 中能够看到 SDK的安装目录。
adb 命令 就在 SDK 安装目录下的 platform-tools 目录下,即下面目录。
/software/adt-bundle-mac-x86_64-20140321/sdk/platform-tools
把这个目录增长到 PATH 设置中。
http://stackoverflow.com/questions/17901692/set-up-adb-on-mac-os-x
而且你的设备要可以使用 adb 调试。
个人手机是华为荣耀6
手机上打开USB调试的方法请参考下面方法:
http://jingyan.baidu.com/article/f25ef25466fbfc482d1b8272.html
须要打开两个设置,以下图:
开启USB调试
开启 MTP,不选这个无法USB调试的。
这两个设置后,咱们在 android studio 上就能够看到能够真机调试了。
adb devices 命令能够看到咱们刚刚配好的真机。
编号跟上面编号一致。
执行
gomobile install golang.org/x/mobile/example/basic
咱们会看见桌面上安装好了这个 basic 应用。
咱们在手机上运行这个应用就能够看到效果。
这个例子在桌面是能够跑的。只需以下运行:
$ cd $GOPATH/src/golang.org/x/mobile/example/basic $ go run main.go
go build 也能够生产该操做系统下的执行文件。
$ cd $GOPATH/src/golang.org/x/mobile/example/basic $ gomobile build $ ls main.go basic.apk
go 提供的几个例子运行截图以下:
gomobile install golang.org/x/mobile/example/audio
gomobile install golang.org/x/mobile/example/flappy
参考:
http://studygolang.com/topics/967
https://github.com/golang/go/wiki/Mobile
http://www.jianshu.com/p/403aa507935b
https://blog.weizhe.net/?p=534
一些例子: