<p>So, we have the <code>mobile</code> library and build tools at last, which is fantastic. It's possible to build NDK-style libraries with Java bindings easily enough if you're so inclined, and there's very low-level support for pure-Go APKs that compile easily.</p>
<p>I'm really, really hoping that this isn't where the story ends, of course. We'd all like, I think, to see a richer system for building pure Go apps on Android (and other platforms). In my view, the priorities are:</p>
<ul>
<li>GUI frameworks that don't require me to spend weeks learning OpenGL</li>
<li>Access to sensor/data and LED/Vibrator/Sound APIs</li>
<li>Sending and Receiving intents, so Golang "microservices" can plug into the "share" menu and process data.</li>
<li>Android APIs for storing and retrieving data, accessing network, etc.</li>
</ul>
<p>Is anyone working on the GUI side of things, in particular? Even basic text/flow based layout engines for Android?</p>
<p>Thanks!</p>
<hr/>**评论:**<br/><br/>besna: <pre><p>I read somewhere that some people use QT for the gui. There shall exist some material design themes and it shall work with Go.</p>
<p>But I didn't tried that yet, I need to find out how I could use that to build something for Blackberry OS10 and Android with the same code base first.</p></pre>cathalgarvey: <pre><p>Sounds interesting: Does QT complicate using the <code>gomobile</code> tool I wonder? Good lead though, thanks!</p></pre>collinglass: <pre><p>I'm hacking on a tiny experimental package. It treats layouts as data and then I use encoding/xml to encode to android xml or HTML. So far I've only got a trivial version working for HTML. It outputs to xml as well but I haven't started connecting it to android code.</p></pre>cathalgarvey: <pre><p>Sounds great! Is it online anywhere? :)</p></pre>enneff: <pre><p>The <a href="https://godoc.org/golang.org/x/exp/shiny">exp/shiny</a> package is an attempt at a cross-platform app framework.</p>
<p>The sensor access and sound libraries you talk about are already part of the mobile repo, as works in progress.</p></pre>cathalgarvey: <pre><p>Oh wow, this looks really promising. For starters, it appears to accept images and just draw them, albiet still at a very low level, making simple 2D games sans-GL code more easy to do, right? For another, it comes with text rendering built in, so at least blocks of text could now be rendered on screen.</p>
<p>It's still way off the mark though IMHO; what I think we really need to let go flourish in its strong area is a framework for reflowable layout, like HTML or Android's XML layout system. While there are Games frameworks in Go popping up (and I'm keeping an eager eye on 'em!), Go is used a lot at the moment for making advanced CLI and server tools, so porting those into Apps would be really easy if input boxes and text output could be made easier.</p>
<p>This points at a webview being the cheap answer for now, though I'm still concerned that using webviews and local microservers might open CORS vurlnerabilities to the local filesystem if implemented incorrectly by app devs. Maybe I'm wrong, I'd love to be in this case.</p></pre>kirizzel: <pre><p>Have you tried running a go webserver on Android, and using a web browser as GUI? </p></pre>cathalgarvey: <pre><p>I absolutely could, and that's the leading option for a pet project right now, but it ends any hope of shipping an app for others. The very first step, "launch this from terminal and then go to localhost..." is a complete no-go for 95% of potential users. Localhost servers also suffer uniquely risky vulnerabilities as the whole filesystem may be considered "same host" for CORS purposes!</p></pre>kirizzel: <pre><p>Would it be possible to create a golang app which on start launches a webview to point at localhoat and starts the server? The approach you describes is definitely not a viable solution from a user perspective.</p></pre>cathalgarvey: <pre><p>That would have the benefit.of being easily packaged as a "turnkey" solution for non-Java gophers: Add your gobind'd library, exposing a standard API set for the webview app, and you're GTG. Add JS and other static resources as gobinary built-ins. Define necessary permissions in Manifest (automateable?).</p>
<p>I'm not even novice-grade at Android app development but would love to see tthis as an interim solution for Go packaging.</p></pre>grutoc: <pre><p>top kek</p></pre>google_you: <pre><p>Mobile is dead. Everything is Node.js and jervascript. React.js Angular.js Gojs</p></pre>Brasilikum: <pre><p>Could you show me a single webapp as snappy as native iOS/android? </p></pre>dhdfdh: <pre><p>Instead of waiting for someone else to do it, you could learn how to code and do it yourself.</p></pre>cathalgarvey: <pre><p>Thanks for that completely useless response, that was great.</p></pre>dhdfdh: <pre><p>I can't think of anything more useless than someone waiting around for someone else to write code for them.</p></pre>aminoglycine: <pre><p>God forbid someone asks a question to ensure not reinventing the wheel</p></pre>dhdfdh: <pre><p>Ah! The reddit catch phrase for everything.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传