Adding TensorFlow to your own Android app

It turns out that adding TensorFlow to your own Android app is easier than iOS. Let's jump right to the steps:

  1. If you have an existing Android app, skip this. Otherwise, in Android Studio, select File | New | New Project... and accept all the defaults before clicking Finish.
  2. Open the build.gradle (Module: app) file, and add compile 'org.tensorflow:tensorflow-android:+' inside and at the end of dependencies {...};.
  3. Build the gradle file and you'll see libtensorflow_inference.so, the TensorFlow native library that Java code talks to, inside the subfolders of the location app/build/intermediates/transforms/mergeJniLibs/debug/0/lib of your app directory.
  4. If this is a new project, you can create the ...

Get Intelligent Mobile Projects with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.