Android native app development get go language support

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed. today's main content for Android native app development get go language support, then we first simply look at what go is?
 
Go is a compiled, developed, and garbage-collected programming language for Google.
 
Google engineers and independent developers have proposed several different proposals designed to enable the go language to support the development of native Android apps. This work does not allow the Go language app to use all of the Android Ndk's interfaces, but it is possible to use a subset of them.
 
David Crawshaw, a Google engineer, wrote a proposal designed to allow the Go Language section to support the writing of Android apps. According to him, "using the go language to achieve the entire Android platform is very difficult." The Android platform is written in Java and has a huge API layer. "
 
However, Crawshaw says some Android apps-such as games-use a much leaner C language API to write code that is provided by the Android NDK. In this way, using the go language to develop the same functionality as the NDK, it is possible to provide support for Android.
 
Crawshaw recommends that the go language code base introduce an option called goos=android in the Go 1.4 development cycle, which provides the following features:
 
provides the go language bindings (binding) for the OpenGL, OpenSL, and OpenMAX interfaces exported from the Android NDK.
from the Java language to the Go Language binding generator (binding generator). If we have a go language package, then this generator can help Java code call it, so the game menu interface can be written directly using the Standard SDK.
 
integrated into the build system of Android Studio.
 
more than Crawshaw a person has put forward the idea of combining the go language with Android. Elias Naur recommends extending the tool chain of the go language to support the creation of dynamic libraries. This allows us to use the Go language libraries in Android apps, which are loaded and run by Android apps and packaged in the APK release. To turn this idea into reality, there is an important precondition: adding support for cross-compilation, and go 1.3 has implemented it. Cross-compilation is required because the NDK itself does not run on Android, but only with the NDK compiled and/or linked executable programs and dynamic libraries to run on Android devices.
 
the above proposal is based on the existing open source project Goandroid, the author is Elias Naur. Goandroid has modified the tool chain and runtime Library of the Go language to enable it to write dynamic libraries that run in native Android apps, which Google does not support.
 
Finally, there is a project called Mandala, which is a more comprehensive framework that aims to enable the go language to write Android native apps. Mandala took advantage of Goandroid's toolchain, its author Andrea Fazzi said, thanking Goandroid, "you can develop, test, and run your app in a desktop environment before you deploy it to Android devices." It encourages you to write Android apps in a unique way in the Go language: Using channels (channels) for communication, not callback functions (callbacks) "
 
in terms of functionality, the Mandala project is close to the Crawshaw proposal, and its goal is primarily to provide solutions for the game: "We should not think of the Mandala framework as an upper-level game engine, but rather build a game engine based on it, Or porting the existing game engine to it. Fazzi warns that Google does not support the use of the go language to develop native Android apps, but he also expressed his expectation that "the current work can be an incentive to enable the Go Language development team to support Android from the official level." "
 
The grammar of the Go language is close to the C language, but the declaration of the variable is different, and the other syntax differs in that the for loop and if judgment are not surrounded by parentheses. The go language supports the garbage collection feature. The parallel model of the Go language is based on Donny Holl CSP, and other languages that take similar models include Occam and limbo, but it also features PI operations, such as channel transmission.
 
in contrast to C + +, the Go language does not include features such as exception handling, inheritance, generics, assertions, virtual functions, but adds language-level support for slice, concurrency, pipelines, garbage collection, Interface (interface), and more. Of course, Google's attitude towards generics is still open, but in the list of frequently asked questions in that language, there is a negative attitude towards the existence of assertions, as well as defending themselves from providing type inheritance. An associative array (also known as a hash table (hashes) or dictionary (dictionaries)) is embedded in the Java,go language, just like a string type.
 

The above is a brief introduction to the go language, but also to understand that the go language is supporting our Android native application development, we hope that the small partners to learn more about the knowledge.

Article from: http://www.alqsoft.com/xinwenzixun/androidkaifa/2014/0709/131.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.