Getting started with tfjs in React Native
1 min readJan 26, 2021
First of all, you are supposed to have Bare React Native Project created using create-react-native-app myapp
or by using expo init myapp
. Anyways, I would specifically ask you to avoid using Managed Workflow provided by expo.
Proceed to the next steps if the created app could be built without any erros.
- You will need to install Android NDK from inside Android Studio or Link .
- Add NDK_PATH to path variables.
- Follow the instructions provided in here . Except for React Native Async Storage.
- Use
npm install react-native-community/async-storage
oryarn install react-native-community/async-storage
to install async-storage in your app. - Do create metro.config.js as per the given specifications.
- Use these for Path Variables for Mac OS. Find similar for Linux or Windows.
export ANDROID_HOME=$HOME/Library/Android/sdk
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
export ANDROID_NDK_ROOT=$ANDROID_SDK_ROOT/ndk-bundle
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=$PATH:$ANDROID_HOME/build-tools/28.0.3
Use this code to test whether tensorflow is ready.
!! HAPPY CODING !!