Building TensorFlow Lite Support Library with Docker

First install Docker

Collect neccessary files and start a container

docker build . -t tf-support-builder -f tflite-android.Dockerfile
docker run -it -v pwd:/host_dir tf-support-builder bash

Download the tensorflow_lite_support folder

Import the script files and tensorflow_lite_support folder at specific locations inside Docker container

docker container ls --all 
docker cp build_support_aar.sh d40836790a39:/tensorflow_src/tensorflow/lite/tools/
docker cp tensorflow_lite_support d40836790a39:/tensorflow_src
docker cp build_support_aar_with_docker.sh d40836790a39:/

Go back at the first Power Shell window and execute linux commands

ls
chmod +x build_support_aar_with_docker.sh
sudo ln -sf /usr/bin/python3 /usr/bin/python
./build_support_aar_with_docker.sh 

Move generated folder from container back to Windows folder

docker cp d40836790a39:tensorflow_src/bazel-bin/tensorflow_lite_support tensorflow-lite-support

Use the final .aar file inside Android Studio

Colab Notebook

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store