Hi guys, don't waste your time, i'm continue from Part 1 right now. Who already installation and setup Go don't need to go back previous thread. i'm using MacOS based then who using other OS try adapt from official site.
Installation and Setup
Download GoMobile from here. you can follow them completely installation but i'm make it shorter than official. Open Terminal then type go get golang.org/x/mobile/cmd/gomobile and hit Enter. then wait until new command prompt appear new line mean done installation. Check GoMobile package should be extract like this image on your root path.

Next, on Terminal as root or admin then type sudo nano -e ~/.bash_profile and hit Enter, you need to input your admin password and hit Enter again, update path to GoMobile bin similar this image. export PATH=$PATH:/Users/poraweeraksasin/go/bin , your path should be like this export PATH=$PATH:/[admin_name]/go/bin then Ctrl + X then it's ask confirm your change just type Y then hit Enter, Then quit Terminal **the setup will affect only fresh open Terminal then this is required to do it.
Re-launch Terminal then type gomobile version and hit Enter, you should have seen similar this image.
Now, you've done installation and setup environment for GoMobile.
Sample Native App
We don't need to create new one from scratch now, we need to completely mobile installation, setup, build and run on physical device that's all. Then download sample by open Terminal and type go get -d golang.org/x/mobile/example/basic and hit Enter. Waiting until new command prompt appear new line.
Android
Generate an apk file
From Terminal type this command gomobile build -target=android golang.org/x/mobile/example/basic and hit Enter. Waiting until new command prompt appear new line. Check result by type find basic.apk you should see result like below image.
Install an apk file
From previous you already have
basic.apk file then you can copy this file to your Android physical device via usb by manual or if you've
adb command installed, it's too easy from here, connect your Android device (open developer mode) via usb then just type
adb install basic.apk and hit
Enter wait until an app installed on your device.
**If you already have adb installed, you can shortcut step of Generate an apk file and Install an apk file with single command by type
gomobile install golang.org/x/mobile/example/basic then hit
Enter, it's build app, generate and install on device automatically same liked above 2 steps.
Run Basic App
Launch Basic App on your Android device, you will see red screen when you tap on screen will see triangle appear, it's blinking dark green and light green, it's follow your touch and move on screen. See performance running at 60 FPS.
iOS
Pre-required From Terminal type gomobile build -target=ios -bundleid=com.porawee.gobasic golang.org/x/mobile/example/basic and hit Enter. then you may have got similar result like this image, the part of message as does not import "goland.org/x/mobile/app" , it's fine for now.
Check your result by type find basic.app and hit Enter, you should've got a result like below image. The first line is basic.app package.
Install basic.app
You should have install ios-deploy if your machine does not have it, this utilities will make it easy and fast installation to your device, so connect your iOS device via usb to MacOS machine then from Terminal as root same as before type ios-deploy -b basic.app and hit
Enter, waiting until progress completed 100% like below image.
Run Basic App
Launch
Basic App on your iOS device, you will see red screen when you tap on screen will see triangle appear, it's blinking dark green and light green, it's follow your touch and move on screen. See performance running at 60 FPS.
Hooray!! now you can build, deploy and run basic app on both iOS and Android device, seem iOS device is smooth and performance better than Android device.
Thank you so much for visit this blog. See U next thread. :)
No Like, No Thumbs Up, No Bell, Please support me by click any interested sponsor, thank you...
Comments
Post a Comment