Using gomobile to generate the native AAR for Android.
- Android NDK
- gomobile
After you installed gomobile, you should use following command to initialize it:
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
You have to ensure that you have gomobile already installed in your go mod, or using the following command to install it.
Install gomobile in this project
go get golang.org/x/mobile/bind
Now, you can start binding this library.
Binding multi platform
gomobile bind -androidapi 29 -target "android/arm64,android/amd64" -ldflags "-s -w" .
Binding specified platform
gomobile bind -androidapi 29 -target android/arm64 -ldflags "-s -w" .
You may use it in your program, that's pretty convenient than executing the binary file.
Since the gomobile only support very basic few types in class converter, it's better to pass a full configuration string which represents the whole config structure in json format.
This repo or its generated library are for study purpose only, absolutely without any warranty, use it at your own risk.