可能这是新手问题,但这需要我 2 天的时间,进度为 0。我在使用 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
我尝试使用函数 main() 和 (MainActivity)java 文件:
http://pastebin.com/61f8pSSb
芜湖不芜
相关分类