gpt4 book ai didi

java - Golang - gomobile 基本脚本编译错误

转载 作者:IT王子 更新时间:2023-10-29 01:48:06 27 4
gpt4 key购买 nike

这可能是新手问题,但这花了我 2 天的时间,但进展为 0。我在 Hello Gopher World 之前在我的手机上使用 Android Studio 进行构建,但是当我尝试使用来自 https://godoc.org/golang.org/x/mobile/example/basic 的“基本”移动脚本进行相同操作时我收到那个错误:

Information:Gradle tasks [:app:compileDebugSources, :app:compileDebugAndroidTestSources]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:hello:gobind
exec: "gcc": executable file not found in %PATH%
C:\gowork\bin\gomobile.exe: go build -p=4 -pkgdir=C:\gowork\pkg\gomobile/pkg_android_arm -tags="" -i -buildmode=c-shared -o=C:\Users\Pablo\AppData\Local\Temp\gomobile-work-627382299\android\src\main\jniLibs\armeabi-v7a\libgojni.so C:\Users\Pablo\AppData\Local\Temp\gomobile-work-627382299\androidlib\main.go failed: exit status 2
# _/C_/Users/Pablo/AppData/Local/Temp/gomobile-work-627382299/go_hello
C:\Users\Pablo\AppData\Local\Temp\gomobile-work-627382299\go_hello\go_hellomain.go:8: imported and not used: "golang.org/x/mobile/bind/seq"
C:\Users\Pablo\AppData\Local\Temp\gomobile-work-627382299\go_hello\go_hellomain.go:9: imported and not used: "golang.org/x/mobile/example/bind/hello"
Error:Execution failed for task ':hello:gobind'.
> Process 'command 'C:/gowork/bin\gomobile.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 8.174 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

也就是hello模块的build.gradle:

plugins {
id "org.golang.mobile.bind" version "0.2.2"
}

gobind {
pkg = "golang.org/x/mobile/example/bind/hello"

GOPATH = "C:/gowork"

GO = "C:/Go"
}

有go文件:(C:\gowork\src\golang.org\x\mobile\example\bind\hello\hello.go)

http://pastebin.com/PPCn6sPE

我尝试使用函数 main() 的 (MainActivity)java 文件:

http://pastebin.com/61f8pSSb

最佳答案

好吧,如果有人在功能上遇到同样的问题,那是我的错,有人向我解释了: https://github.com/golang/go/issues/12842

简而言之,我尝试构建原生 Go 应用。

关于java - Golang - gomobile 基本脚本编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32892296/

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