Frequently Asked Questions
We are constantly looking for ways to improve PlayTorch. If you have questions or feedback, please file an issue on GitHub.
General Setup
Q: How to fix Error: error: SDK "iphoneos" cannot be located
?
A: This type of error can result if you don't have Xcode installed locally. If you have installed Xcode, please make sure to open the app and accept the Xcode license.
If you have completed this before, please check the Developer Directory path by running xcode-select -p
. Please change it to the location where Xcode is installed by running
sudo xcode-select -s /Applications/<Xcode.app>/Contents/Developer
.
Metro
Q: How to fix Error: error:0308010C:digital envelope routines::unsupported
?
A: Metro can fail with Node.js version 17 (see screenshot for error). A fix for this issue is to use any of the LTS (long-term support) version of Node.js including 12, 14, and 16.
note
You can find more details on the issue in the Node.js GitHub repository reported in issue #40455.
Android
Q: What to do when the device shows the error unable to load script from assets index.android.bundle
?
A: If You are running your application on physical device and getting this error, try running the adb reverse
command:
adb reverse tcp:8081 tcp:8081
The adb reverse
allows loading the JavaScript bundle from the Metro bundler when in development mode using a physical device.
tip
Android Debug Bridge (adb) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.
Source: https://developer.android.com/studio/command-line/adb
Q: What to do when we encounter an error which says Could not find tools.jar. Please check that <some_path> contains a valid JDK installation.
when installing the app?
A: Please follow the React Native environment setup instructions, which has detailed step-by-step instructions for how to set up a React Native development environment.
If the error persists, set the JAVA_HOME
enviromnent variable to the local JDK installation path. On macOS, you can set the JAVA_HOME
variable by running
export JAVA_HOME=/Library/Java/JavaVirtualMachines/<jdk_folder>/Contents/Home
Mobile Models
Q: Is it possible to secure a model that will be downloaded into PlayTorch?
A: PyTorch does not provide security at the model-level. Most mobile platforms such as iOS and Android cannot guarantee secure transmission and storage of ML models as hardware-level security is unavailable to the apps.
If security of ML model is desired then you may get close by turning off debugging and backup in the app manifest for Android. If you do this then the data stored in your local app data directory cannot be extracted without rooting the device.
Another possibility is to encrypt the model and store the encrypted model in the underlying platform-provided secure location. This will likely increase latency and may impact other metrics that your app may care about. You may want to consider securing the ML model using any mechanism that you use for securing other valuable assets in use by the app.