Golang – gomobile基本脚本编译错误

huangapple 未分类评论78阅读模式
英文:

Golang - gomobile basic script compile error

问题

可能这是一个新手问题,但我已经花了2天时间,没有任何进展。
我之前使用Android Studio在我的手机上构建了Hello Gopher World,但是当我尝试使用https://godoc.org/golang.org/x/mobile/example/basic中的'basic'移动脚本进行相同的操作时,我遇到了以下错误:

  1. 信息:Gradle任务[:app:compileDebugSources,:app:compileDebugAndroidTestSources]
  2. :app:preBuild UP-TO-DATE
  3. :app:preDebugBuild UP-TO-DATE
  4. :app:checkDebugManifest
  5. :app:preReleaseBuild UP-TO-DATE
  6. :hello:gobind
  7. exec:“gcc”:在%PATH%中找不到可执行文件
  8. C:\gowork\bin\gomobile.exego 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 失败:退出状态2
  9. # _/C_/Users/Pablo/AppData/Local/Temp/gomobile-work-627382299/go_hello
  10. C:\Users\Pablo\AppData\Local\Temp\gomobile-work-627382299\go_hello\go_hellomain.go:8: 导入但未使用:“golang.org/x/mobile/bind/seq
  11. C:\Users\Pablo\AppData\Local\Temp\gomobile-work-627382299\go_hello\go_hellomain.go:9: 导入但未使用:“golang.org/x/mobile/example/bind/hello
  12. 错误:任务':hello:gobind'执行失败。
  13. > 进程'命令'C:/gowork/bin\gomobile.exe''以非零退出值完成
  14. 信息:构建失败
  15. 信息:总时间:8.174
  16. 信息:1个错误
  17. 信息:0个警告
  18. 信息:请在控制台中查看完整输出

这是hello模块的build.gradle文件:

  1. 插件{
  2. idorg.golang.mobile.bind”版本“0.2.2
  3. }
  4. gobind{
  5. pkg =“golang.org/x/mobile/example/bind/hello
  6. GOPATH =“C:/gowork
  7. GO =“C:/Go
  8. }

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

http://pastebin.com/PPCn6sPE

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

http://pastebin.com/61f8pSSb

英文:

Probably that is newbie question, but that takes me 2 days with 0 progress.
I build before Hello Gopher World on my mobile with Android Studio, but when I tried to do that same with 'basic' mobile script from https://godoc.org/golang.org/x/mobile/example/basic
I get that error:

  1. Information:Gradle tasks [:app:compileDebugSources, :app:compileDebugAndroidTestSources]
  2. :app:preBuild UP-TO-DATE
  3. :app:preDebugBuild UP-TO-DATE
  4. :app:checkDebugManifest
  5. :app:preReleaseBuild UP-TO-DATE
  6. :hello:gobind
  7. exec: "gcc": executable file not found in %PATH%
  8. 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
  9. # _/C_/Users/Pablo/AppData/Local/Temp/gomobile-work-627382299/go_hello
  10. 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"
  11. 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"
  12. Error:Execution failed for task ':hello:gobind'.
  13. > Process 'command 'C:/gowork/bin\gomobile.exe'' finished with non-zero exit value 1
  14. Information:BUILD FAILED
  15. Information:Total time: 8.174 secs
  16. Information:1 error
  17. Information:0 warnings
  18. Information:See complete output in console

That is build.gradle of hello module:

  1. plugins {
  2. id "org.golang.mobile.bind" version "0.2.2"
  3. }
  4. gobind {
  5. pkg = "golang.org/x/mobile/example/bind/hello"
  6. GOPATH = "C:/gowork"
  7. GO = "C:/Go"
  8. }

There is go file: (C:\gowork\src\golang.org\x\mobile\example\bind\hello\hello.go)

http://pastebin.com/PPCn6sPE

And (MainActivity)java file from I try to use function main():

http://pastebin.com/61f8pSSb

答案1

得分: 0

好的,以下是翻译好的内容:

好的,如果将来有人遇到同样的问题,有人向我解释了:
https://github.com/golang/go/issues/12842

简而言之,我尝试构建本地的Go应用程序。

英文:

Ok, my fault if somebody will have same problem in feature there somebody explained me:
https://github.com/golang/go/issues/12842

In short I tried to build native Go app.

huangapple
  • 本文由 发表于 2015年10月2日 00:17:20
  • 转载请务必保留本文链接:https://java.coder-hub.com/32892296.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定