当前位置:网站首页>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

边栏推荐
- Use of sed in shell script
- HTTP Caching Protocol practice
- Common optimization items
- 2022 recommended quantum industry research industry development planning prospect investment market analysis report (the attachment is a link to the online disk, and the report is continuously updated
- 2022 recommended tire industry research report industry development prospect market analysis white paper
- Tcapulusdb Jun · industry news collection (III)
- The first commercial spacewalk of mankind is finalized! Musk SpaceX announced a new round of space travel plan, and the American rich became repeat customers
- [high concurrency] deeply analyze the callable interface
- ICLR is going to have a big discussion on the deep generation model. Max welling and the winner of the AAAI million dollar award are here. Bengio is one of the organizers
- HTTP Caching Protocol practice
猜你喜欢

Open source demo| you draw and I guess -- make your life more interesting

Annual inventory review of Alibaba cloud's observable practices in 2021

Analysis report on the investment market of the development planning prospect of the recommended rare earth industry research industry in 2022 (the attachment is a link to the online disk, and the rep

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

How to choose congestion model and anemia model

Introduction to Photoshop (the first case)

Conditional test, if and case conditional test statements of shell script

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

Tcapulusdb Jun · industry news collection (III)

HTTP Caching Protocol practice
随机推荐
Difference between parametric continuity and geometric continuity
patent filter
Modularization and modular specification commonjs
AttributeError: module ‘torch. nn. Parameter 'has no attribute' uninitializedparameter 'solution
[IOT] description of renaming the official account "Jianyi commerce" to "product renweipeng"
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?
patent filter
Le langage C imprime "Love", "Mars hit Earth" et ainsi de suite en utilisant printf, qui est constamment mis à jour
51 single chip microcomputer learning notes 7 -- Ultrasonic Ranging
机器人强化学习——第一人称 VS 第三人称
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
PCI Verilog IP
Distributed transaction Seata
Leetcode notes on question brushing (XIV) -- related topics of binary tree attributes in binary tree chapter
Common optimization items
Design risc-v processor from scratch -- data adventure of five stage pipeline
2022 recommended tire industry research report industry development prospect market analysis white paper
Pytest (7) -yield and termination function
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
Satellite navigation time service related terms Collection Edition