github.com/psiphon-labs/psiphon-tunnel-core@v2.0.28+incompatible/MobileLibrary/Android/README.md (about)

     1  ## Psiphon Android Library README
     2  
     3  ### Overview
     4  
     5  Psiphon Library for Android enables you to easily embed Psiphon in your Android
     6  app.
     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  
    17  1. Add maven repo to your app build.gradle
    18  ```
    19  repositories {
    20      ...
    21      maven {
    22          url "https://raw.github.com/Psiphon-Labs/psiphon-tunnel-core-Android-library/master"
    23      }
    24  }
    25  ```
    26  then add PsiphonTunnel dependency like following
    27  ```
    28  dependencies {
    29      ...
    30      implementation 'ca.psiphon:psiphontunnel:x.y.z'
    31  }
    32  ```
    33  Where 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  
    35  See example usage in [TunneledWebView sample app](./SampleApps/TunneledWebView/README.md)
    36  
    37  ### Building with Docker
    38  
    39  Note that you may need to use `sudo docker` below, depending on your OS.
    40  
    41  ##### Create the build image:
    42  
    43  1. While in the `MobileLibrary/Android` directory, run the command: `docker build --no-cache=true -t psiandroid .`
    44  
    45  2. 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
    52  cd ../.. && \
    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  
    61  When 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.15 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`