Gomobile 绑定(bind) : unsupported basic type: uint64

标签 go gomobile

文档说应该支持。 好像在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。

基于以上的两种解决方案:

  1. 将非法类型对 Java 的暴露限制在最低限度
  2. 在 Go 中将 uint64 转换为 int64,在 Java 中从 long 转换为 BigInteger。

关于Gomobile 绑定(bind) : unsupported basic type: uint64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45468778/

相关文章:

c - inb() 和 outb() Linux 系统调用的包装器

mongodb - 如何将更新功能应用于 MongoDB 集合中的所有文档(使用 mgo)?

GoMobile 版本 : Cannot find package

go - 使用 gomobile 访问地理位置数据

手机兼容性

go - 工作线程池

go - 在缓冲区接收数据时将 exec.Command 输出复制到文件

ios - 网络扩展日志

android - `gomobile build` 和 `gomobile install` 抛出 "gomobile: EOF"

go - 从 Golang 中的 AWS Lambda 函数读取参数