Golang - gomobile基本脚本编译错误

时间:2015-10-01 16:17:21

标签: java android go

可能这是新手问题,但这需要我2天才能取得进展。 我使用Android Studio在我的手机上使用Hello Gopher World构建,但当我尝试使用来自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

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

http://pastebin.com/61f8pSSb

1 个答案:

答案 0 :(得分:0)

好的,我的错,如果有人在功能方面有同样的问题,有人解释我: https://github.com/golang/go/issues/12842

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