Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • E EncounterBasedCommunication
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3
    • Issues 3
    • List
    • Boards
    • Service Desk
    • Milestones
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • encounters
  • EncounterBasedCommunication
  • Wiki
  • Library (android)
  • Setup

Setup · Changes

Page history
Update Setup authored Jul 06, 2018 by Lily Tsai's avatar Lily Tsai
Hide whitespace changes
Inline Side-by-side
Library-(Android)/Setup.md 0 → 100644
View page @ 1f454db1
# Table of Contents
1. [Things you'll need](#things-you-need-from-me)
2. [Installing Android Studio](#installing-android-studio)
3. [JNI (native code compilation)](#jni)
4. [Deploying to Bintray](#deploying-the-ebclibrary-to-bintray)
-----------------------------------------------------------------------------------
### THINGS YOU NEED FROM ME (i.e., essential files not included with git)
* `raw/ebc_config` files for logging into ES (basically the ES API Key and also the EbC API Key). These go into the resource files of the example / test applications, or any other application that wants to use the ebclibrary (see the [README](readme) for more details
* `local.properties` file with the bintray API key / username to upload the library to Bintray (might also want to change the account so anyone can log in, not just me)
-----------------------------------------------------------------------------------
### Installing Android Studio
You'll want to install Android Studio (latest version) with Gradle and the SDK and NDK (support for jni).
-----------------------------------------------------------------------------------
### JNI
There is a part of the ebclibrary module that still runs in C. This basically generates new DH keys (nonces) and does the crypto stuff for computing shared secrets. It also currently tracks which devices have been seen / encountered already, and determines when an encounter has ended (hysteresis stuff).
Hopefully this won't need to be modified at all. But to build the library, you will need to be able to use NDK (the `ndk-build` command basically makes the .so files used by the Android code). To do so, you need to install the ndk packages (which you can do with Android Studio when you download the SDK, or download them by themselves) and also set the following environment variables (I put them in ./bashrc). You might need to set some variables for Java like I did, but I'm not sure if it's needed.
```
#for Android Encounter dev
export ANDROID_HOME=/home/tslilyai/Android/Sdk
export ANDROID_SDK_ROOT=/home/tslilyai/Android/Sdk
export NDKROOT=/home/tslilyai/Android/Sdk/ndk-bundle
export NDK_ROOT=/home/tslilyai/Android/Sdk/ndk-bundle
export NDK_STANDALONE_46_ANDROID9="/home/tslilyai/Android/Sdk/ndk-bundle"
export PATH=$PATH:$NDKROOT:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:/home/tslilyai/AndroidSource/prebuilts/jdk/jdk8/linux-x86/bin
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_151
export PATH=$PATH:$JAVA_HOME/bin
```
After setting all these things, running `ndk-build` in the folder `ebclibrary/src/main/jni` should work. Unfortunately, gradle seems to want the .so files put in the jniLibs folder (and not libs, which is where `ndk-build` puts them), which is why `ndk-build-script.sh` copies the .so files to the right place.
-----------------------------------------------------------------------------------
### Deploying the ebclibrary to Bintray
In the `[root_folder]/build.gradle` change the version number to something appropriate. You'll need to set local.properties correctly with the bintray username (right now tslilyai) and API key. I guess I can give it to you (email me or something)? Then run the command
```
./gradlew clean :ebcutils:build :ebclibrary:build :ebclibrary:bintrayUpload
```
from your root folder. This should upload the version to Bintray.
If we want the library to be accessible from JCenter, log into the Bintray account (I'll have to unlink this from my github repo or else I'll be the only one who can do this) and then click "Add to JCenter" on the package editing page. They should get back to you in a couple days and then it'll be published!
Also, you might need to set a line in the gradle.build file for ebclibrary to use the ebcutils jar rather than include it as another module:
```java
// COMMENT THIS API LINE OUT
api project(path: ':ebcutils')
// UNCOMMENT THIS LINE
implementation fileTree(include: ['*.jar'], dir: '../ebcutils/build/libs')
```
Clone repository
  • Design
    • Communicating over Encounters
    • Database (Android)
    • Encounter Formation and Confirmation
    • Forwarding Design Writeup
  • Forwarding Cloud Agent
    • Code Overview
    • Experiments
    • Setup
  • Home
  • Library (Android)
    • Code Overview
    • Experiments
    • Setup
  • TODOs