Bindings for Android: need to generate aar before importing

Adrian Wan 2021-02-17 12:38:16 -08:00
parent a646dc77d1
commit 08e1eb3c3b

@ -132,17 +132,17 @@ $ go get -d golang.org/x/mobile/example/bind/...
Note: Go Mobile runs on the same architectures as Go, which currently means ARM, ARM64, 386 and amd64 devices and emulators. Notably, Android on MIPS devices is not yet supported.
* Launch Android Studio.
* File > Import Project... to import the reference project from $GOPATH/src/golang.org/x/mobile/example/bind/android.
![Android Studio](http://i.imgur.com/RhNCnnH.png)
* Run the following command to generate the [aar](https://developer.android.com/studio/projects/android-library.html) file that is suitable for importing into Android projects:
```
$ gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello
```
* Launch Android Studio.
* File > Import Project... to import the reference project from $GOPATH/src/golang.org/x/mobile/example/bind/android.
![Android Studio](http://i.imgur.com/RhNCnnH.png)
* Build and deploy the application to the device.
The app module contains the main application that invokes the `hello.Greetings`. When the application is launched the text view is updated with the string returned value.