Monday, August 06, 2018

Building an Android App with Sovrin

Thanks to the hard work of Mohammad Abdul Sami Sovrin enthusiasts now have support building libindy for Android in the master branch of our repo.

You can now build the libindy libraries for Android by just running a script. Yeah!
If you want to spare that building process you can download the libraries from Evernym. Thanks!

Now what? You have a for arm, arm64 and x86, but how do you use it?

I have created an Android Studio sample application DroidLibIndy that you might use as a starting point (if you don't like reading blog posts).

Still reading? Here is a list of quirks you need in your flashy new Indy-App.

  1. First you have to put the libindy library into the correct jni folder e.g.:
    This other way to do this did not work for me.
  2. Source code and Target compatibility have to be Java 1.8
    Otherwise CompletableFuture and other stuff do not compile
  3. You need a network security policy because libindy secures its communication using zeromq and Android only accepts HTTPS as a secure protocol.
  4. You might need a lint.xml to get JNA linked.
  5. Copy libindy's Java wrapper code to your project using the path org/hyperledger/indy/sdk.
    cp -r ~pathto/indy-sdk/wrappers/java/src/main/java/org/ pathtoyourapp/app/src/main/java/
    I did not try the maven route here.
  6. In your app's onCreate method set the environment variable 'EXTERNAL_STORAGE'
  7. Of course you need to have all the dependencies configured in your build system.
As always: PRs are welcome! Please contribute to libindy. It's easy.

Have fun exploring Hyperledger Indy on Android!

No comments: