当前位置:网站首页>There are two ways for golang to develop mobile applications
There are two ways for golang to develop mobile applications
2022-06-29 05:49:00 【kuokay】
In short
Use Go Language development Android&IOS application , There are two main ways , One is based on native application development , The other is mixed binding development .
precondition
Download and install Go Language ( edition 1.5+)https://www.golang.org/
Download and install gomobile
download $ go get golang.org/x/mobile/cmd/gomobile install ( It takes a few minutes ) gomobile init
Native application development mode
$ go get -d golang.org/x/mobile/example/basic
Main application fields :
- Application control management and configuration
- OpenGL ES 2 binding
- Asset management
- Event management
- Package under test , contain OpenAL binding 、 Audio 、 typeface 、 Graphics and motion sensors
Android Development
- $ gomobile build -target=android golang.org/x/mobile/example/basic
This command generates a file named basic Of apk Installation package - $ gomobile install golang.org/x/mobile/example/basic This command will install apk Package to connected android equipment
IOS Development
$ gomobile build -target=ios golang.org/x/mobile/example/basic This command generates a file named basic Of app Installation package
download IOS Install package command line tools - ios-deploy $ ios-deploy -b basic.app This command will install app File to open IOS Simulator or connected IOS equipment
Hybrid binding development
$ go get -d golang.org/x/mobile/example/bind/...
advantage
- Go code Reuse
stay Android and IOS Share common in development Go The code is bound by calling Golang Package name
Limit - Currently only some are supported Go type
Binding between languages has performance overhead
Android Development
Turn on Android studio, Import Project, Choose the path $GOPATH/src/golang.org/x/mobile/example/bind/android

Modify the configuration file hello/build.gradle

Last Build & Run
Alternative options :
$ gomobile bind -target=android golang.org/x/mobile/example/bind/hello
* This order will be in hello/ Generate... Under path aar file *, Users can directly Android Studio Import in
IOS Development
$ cd $GOPATH/src/golang.org/x/mobile/example/bind $ gomobile bind -target=ios golang.org/x/mobile/example/bind/hello
This command is on the ios/ Generate... Under path bind.xcodeprojxcode Project and stay bind/ Create one in the directory hello.framework
- open xcode project $ open ios/bind.xcodeproj

- Drag and drop hello.framework File to xcode Within the project

- Last Build & Run

边栏推荐
- [high concurrency] deeply analyze the callable interface
- 51 lines of code, self-made TX to MySQL software!
- 2022 recommended property management industry research report industry development prospect market investment analysis (the attachment is the link to the online disk, and the report is continuously up
- gan semi conductor
- Use typescript compiler parameter 'skiplibcheck' - usage of the typescript compiler argument'skiplibcheck'
- On February 15, the market hot money operation and the dragon and tiger list
- The first in China! CICA technology database antdb appears at the performance test tool conference of China Academy of communications technology
- Personal blog item: processing of reading number +1 after viewing article details
- Analysis report on the investment market of the development planning prospect of the recommended NFT industry research industry in 2022 (the attachment is a link to the online disk, and the report is
- Est - ce que l'ouverture d'un compte de titres est sécurisée? Y a - t - il un danger?
猜你喜欢

Research on heuristic intelligent task scheduling

Why can't the article be posted?

2022 recommended RCEP regional comprehensive economic partnership agreement market quotation Investment Analysis Industry Research Report (the attachment is a link to the online disk, and the report i

开启生态新姿势 | 使用 WordPress 远程附件存储到 COS

机器人强化学习——Transferring End-to-End Visuomotor Control from Simulation to RealWorld (CoRL 2017)

Introduction to Photoshop (the first case)

Research Report on the recommended lithography industry in 2022 industry development prospect market investment analysis (the attachment is a link to the network disk, and the report is continuously u

2022 recommended REITs Industry Research Report investment strategy industry development prospect market analysis (the attachment is a link to the online disk, and the report is continuously updated)

Boost the digital economy and face the future office | the launch of the new version of spreadjsv15.0 is about to begin
![ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience](/img/fd/4c24e10fc91a7ce7e709a0874ba675.jpg)
ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience
随机推荐
D Author: import C programming in D
【IoT】公众号“简一商业”更名为“产品人卫朋”说明
HTTP Caching Protocol practice
Leetcode theme [array] -219- duplicate Element II exists
嵌入式RTOS
5,10,15,20-tetra (3,5-dimethoxyphenyl) porphyrin ((tdmpp) H2) /2-nitro-5,10,15,20-tetra (3,5-dimethoxyphenyl) porphyrin copper (no2tdmpp) Cu) supplied by Qiyue
Alibaba microservice component Sentinel
Introduction to Photoshop (the first case)
嵌入式RTOS
Ghost in the Log4Shell
innography
Use VS to create a static link library Lib and use
[high concurrency] deeply analyze the callable interface
Meso tetra (4-N, N, n-trimethylaminophenyl) porphyrin (ttmapp) /meso tetra - [4- (BOC threonine) aminophenyl] porphyrin (TAPP thr BOC) supplied by Qiyue
Would like to ask, which is the better choice for securities companies? I don't understand. Is it safe to open an account online now?
QT precautions and RCC download address
2-nitro-5,10,15,20-tetra (4-methylphenyl) porphyrin copper (no2tmpp) Cu) /2-nitro-5,10,15,20-tetra (4-methylphenyl) porphyrin (no2tmpp) H2) Qiyue porphyrin supply
Programming specification and variables of shell script
After nine years of testing, the salary for interviewing Huawei is 10000. Huawei employees: the company doesn't have such a low salary position
证券开户安全么,有没有什么危险呢