Skip to content

Instantly share code, notes, and snippets.

@abeluck
Created September 15, 2022 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abeluck/4e148bee2248976c55b37d245073fb12 to your computer and use it in GitHub Desktop.
Save abeluck/4e148bee2248976c55b37d245073fb12 to your computer and use it in GitHub Desktop.

Build Notes

@abeluck's build notes for ipfs-shipyard/gomobile-ipfs

Go setup

Install golang. I used 1.18 from the fedora repos.

Python setup

You'll need python3 with pip available.

Android Studio Setup

In SDK Manager

  • Use SDK Platform Android 11.0 (R)
  • in SDK Tools use NDK (Side by side) version 23.1.7779620

My virutal device is a Pixel 4 API 30 running Android 11

Env setup

You'll need the following to build the local go lib

Env file

export ANDROID_HOME="$HOME/Android/Sdk"
export ANDROID_NDK_HOME="$ANDROID_HOME/ndk/23.1.7779620"

export GOPATH="$HOME/go"

export JAVA_HOME="$HOME/vendor/android-studio/jre"

export PATH="$PATH:$ANDROID_HOME/emulator"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
export PATH="$PATH:$GOPATH/bin"
export PATH="$PATH:$JAVA_HOME/bin"

Build it

Build the go library

cd gomobile-ipfs/packages
make build_core.android

# note: this takes quite a while in a fresh go env

Generate the bridge AAR

cd gomobile-ipfs/android/bridge
gradle build   # (i ran this via Android Studio not the cli)

Open in Android Studio

Open the gomobile-ipfs/android folder as a new project in Android Studio.

Build it and run the application.

AARs that need to be published

  • gomobile-ipfs/android/bridge/build/outputs/aar/bridge-debug.aar
  • gomobile-ipfs/packages/build/android/maven/ipfs/gomobile/core/0.0.42-dev/core-0.0.42-dev.aar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment