安装
go install golang.org/x/mobile/cmd/...@latest
参考:
no usable NDK 错误
gomobile build -target=android github.com/ghj1976/games/nerveincats/nic
gomobile: no usable NDK in /Users/guohongjun/Library/Android/sdk: open /Users/guohongjun/Library/Android/sdk/ndk: no such file or directory, open /Users/guohongjun/Library/Android/sdk/ndk-bundle/meta/platforms.json: no such file or directory
Android Studio 安装后,默认并没安装NDK,需要自己手工再安装。
unsupported API version 16 (not in 19..33) 错误
gomobile build -target=android github.com/ghj1976/games/nerveincats/nic
gomobile: no usable NDK in /Users/guohongjun/Library/Android/sdk: unsupported API version 16 (not in 19..33), open /Users/guohongjun/Library/Android/sdk/ndk-bundle/meta/platforms.json: no such file or directory
解决方法:
Android Studio 的 File -> New Project Setup -> Default Project Structure 菜单
点击 "Download" Android NDK. 就可以解决这个问题
部署到鸿蒙OS手机
使用华为手机助手 APP 即可。
华为手机通过USB插入后就可以出现对应安装程序。