gpt4 book ai didi

android - 找不到gobind可执行文件

转载 作者:数据小太阳 更新时间:2023-10-29 03:03:25 26 4
gpt4 key购买 nike

我正在尝试通过运行命令 gomobile bind 生成 aar 文件,如下所示:

gomobile bind -target=android golang.org/x/mobile/example/bind/hello

但总是会出现如下错误:

gomobile: gobind -lang=go,java -outdir=/var/folders/s_/yzvdrlg522z237w58tjn2rm00000gp/T/gomobile-work-931510225 golang.org/x/mobile/example/bind/hello failed: exec: "gobind": executable file not found in $PATH

我已经尝试在 GobindPlugin.groovyGobindExtension 内指定路径,如下所示:

class GobindExtension {
// Package to bind. Separate multiple packages with spaces. (required)
def String pkg = "golang.org/x/mobile/example/bind/hello"

// GOPATH: necessary for gomobile tool. (required)
def String GOPATH = System.getenv("GOPATH")

// GO: path to go tool. (can omit if 'go' is in the paths visible by Android Studio)
def String GO = "/usr/local/opt/go/libexec/bin"

// GOMOBILE: path to gomobile binary. (can omit if 'gomobile' is under GOPATH)
def String GOMOBILE = "/Users/vierdamila1/Desktop/go-workspace/bin/gomobile"
}

这是我的 GOPATH:

export GOPATH="/Users/vierdamila1/Desktop/go-workspace"

但还是不行。我在这里错过了什么吗?非常感谢任何帮助。

最佳答案

我想我找到了解决方案,我把它放在这里是为了可能需要答案的人。实际上出现错误是因为我还没有安装 gobind。因此,在执行 gomobile bind 之前,不要忘记通过运行以下命令来安装 gobind :

go install golang.org/x/mobile/cmd/gobind

之后调用绑定(bind)命令:

gomobile bind -target=android golang.org/x/mobile/example/bind/hello

绑定(bind)命令将生成 hello.aar 文件,您可以将其放入您的 Android 项目 libs 文件夹中。

关于android - 找不到gobind可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49376752/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com