编译 Android 后运行 Go 脚本。

huangapple go评论83阅读模式
英文:

run go script after compile android

问题

Go似乎是Android中得到很好支持的脚本语言。然而,从文档中可以明确看出,谷歌希望在编译之前将所有的Go脚本包含在Android项目中。有没有办法避免这样做呢?

我能否在编译后运行一个脚本?比如从后端服务器下载一个脚本然后直接运行它?

英文:

Go seems to be a well supported scripting language in Android. However, from the documentation it is clear that google wants you to include all go scripts in your Android project before compilation. Is there a way to avoid this?

Could I run a script created after compilation? Like downloading a script from a backend server and just run it?

答案1

得分: 2

Go需要像C库一样进行链接。Go是一种编译语言,而不是脚本语言。根据你的建议,你需要下载并执行一个基本上是任意的可执行文件,据我所知,这是不被支持的。

一个可能的方法是下载并动态链接你创建的Go库。然而,我不确定是否真的可以实现这一点。

英文:

Go needs to be linked in the same manor as a C library would be. Go is also a compiled language, not a scripting language. To do as you suggest you would need to be downloading and executing an essentially arbitrary executable which as far as I am aware is not supported.

One possible avenue, would be downloading and dynamically linking the Go library you create. However I am not sure if that is actually achievable.

huangapple
  • 本文由 发表于 2017年4月28日 04:28:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/43667342.html
匿名

发表评论

匿名网友

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

确定