1## Psiphon Android Library README 2 3### Overview 4 5Psiphon Library for Android enables you to easily embed Psiphon in your Android 6app. 7 8### Using the Library 9 10#### If building from source 11 12 1. Build `ca.psiphon.aar` from via the docker container. 13 2. Add `ca.psiphon.aar` to your Android Studio project as described in the [gomobile documentation](https://godoc.org/golang.org/x/mobile/cmd/gomobile) 14 15#### If using Maven based binary distribution 16 171. Add maven repo to your app build.gradle 18``` 19repositories { 20 ... 21 maven { 22 url "https://raw.github.com/Psiphon-Labs/psiphon-tunnel-core-Android-library/master" 23 } 24} 25``` 26then add PsiphonTunnel dependency like following 27``` 28dependencies { 29 ... 30 implementation 'ca.psiphon:psiphontunnel:x.y.z' 31} 32``` 33Where x.y.z is the target version. Latest available release version can be found at https://github.com/Psiphon-Labs/psiphon-tunnel-core-Android-library 34 35See example usage in [TunneledWebView sample app](./SampleApps/TunneledWebView/README.md) 36 37### Building with Docker 38 39Note that you may need to use `sudo docker` below, depending on your OS. 40 41##### Create the build image: 42 431. While in the `MobileLibrary/Android` directory, run the command: `docker build --no-cache=true -t psiandroid .` 44 452. Once completed, verify that you see an image named `psiandroid` when running: `docker images` 46 47##### Run the build: 48 49*Ensure that the command below is run from within the `MobileLibrary/Android` directory* 50 51```bash 52cd ../.. && \ 53 docker run \ 54 --rm \ 55 -v $(pwd):/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core \ 56 psiandroid \ 57 /bin/bash -c 'cd /go/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android && ./make.bash' \ 58; cd - 59``` 60 61When that command completes, the compiled `.aar` files (suitable for use in an Android Studio project) will be located in the current directory (it will likely be owned by root, so be sure to `chown` to an appropriate user). 62 63### Building without Docker (from source) 64 65##### Prerequisites: 66 67 - The `build-essential` package (on Debian based systems - or its equivalent for your platform) 68 - Go 1.13 or later 69 - Full JDK 70 - Android NDK 71 - Android SDK 72 73##### Steps: 74 75 1. Follow Go Android documentation ([gomobile documentation](https://godoc.org/golang.org/x/mobile/cmd/gomobile)) 76 2. Run `make.bash` 77