文档说应该支持。 好像在gen.go文件中没有实现:
case types.Uint8: // types.Byte
return "uint8_t"
// TODO(crawshaw): case types.Uint, types.Uint16, types.Uint32, types.Uint64:
我读到我需要打补丁去移动支持 但是在更改文件以支持 Uint64 之后,(go/src/golang.org/x/mobile/bind/gen.go) 并重新初始化移动:gomobile init
还是出现同样的错误,我是不是遗漏了什么明显的东西?
最佳答案
我认为这里的问题是 Java 没有 unsigned。因此,Java 接口(interface)不能将 uint64(和 uint32 IIRC)文件类型作为全局变量、函数返回值或函数参数。
您可以在 Go mobile 中使用 uint64。
基于以上的两种解决方案:
- 将非法类型对 Java 的暴露限制在最低限度
- 在 Go 中将 uint64 转换为 int64,在 Java 中从 long 转换为 BigInteger。
关于Gomobile 绑定(bind) : unsupported basic type: uint64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45468778/