• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1TensorFlow-Android-Inference
2============================
3This directory contains CMake support for building the Android Java Inference
4interface to the TensorFlow native APIs.
5
6See [tensorflow/contrib/android](..) for more details about the library, and
7instructions for building with Bazel.
8
9Usage
10-----
11Add TensorFlow-Android-Inference as a dependency of your Android application
12
13* settings.gradle
14
15```
16include ':TensorFlow-Android-Inference'
17findProject(":TensorFlow-Android-Inference").projectDir =
18            new File("${/path/to/tensorflow_repo}/contrib/android/cmake")
19```
20
21* application's build.gradle (adding dependency):
22
23```
24debugCompile project(path: ':tensorflow_inference', configuration: 'debug')
25releaseCompile project(path: ':tensorflow_inference', configuration: 'release')
26```
27Note: this makes native code in the lib traceable from your app.
28
29Dependencies
30------------
31TensorFlow-Android-Inference depends on the TensorFlow static libs already built
32in your local TensorFlow repo directory. For Linux/Mac OS, build_all_android.sh
33is used in build.gradle to build it. It DOES take time to build the core libs;
34so, by default, it is commented out to avoid confusion (otherwise
35Android Studio would appear to hang during opening the project).
36To enable it, refer to the comment in
37
38* build.gradle
39
40Output
41------
42- TensorFlow-Inference-debug.aar
43- TensorFlow-Inference-release.aar
44
45File libtensorflow_inference.so should be packed under jni/${ANDROID_ABI}/
46in the above aar, and it is transparent to the app as it will access them via
47equivalent java APIs.
48
49