Following are some issues related to development of react native applications
If it shows one or more of following
Check java version with java -version
(Java 8) or java --version
(Java 14)
Switch to jdk 8 if some other version is shown
If some task like 'installDebug' is not found in project then
Open android folder of react-native application in Android Studio
Wait till Android Studio syncs Gradle
Close Android Studio and run react-native run-android
Enoent is "No such file or directory"
Check ANDROID_SDK_ROOT
echo $ANDROID_SDK_ROOT
If it doesn't return a path, then set its path in bash configuration with something like
echo "ANDROID_SDK_ROOT:<android_sdk_path>"|tee -a ~/.bashrc && source ~/.bashrc
where <android_sdk_path>
is path to some directory/android/Sdk
and ~/.bashrc
is bash configuration file
If it returns false path, change its path in bash configuration file (.bashrc or .bash_profile or .zshrc)
increase the fs.inotify.max_user_watches sysctl with following command
echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances && watchman shutdown-server
Check values of max_user_watches, max_user_instances
cat /proc/sys/fs/inotify/max_user_watches
cat /proc/sys/fs/inotify/max_user_instances
Check if metro instance (local dev server) is running, or is running for another app/from another folder than root directory of application
Metro can be started from root directory of an application with:
react-native start
Check if metro instance (local dev server) is running, or is running for another app/from another folder than root directory of application
Metro can be started from root directory of an application with:
react-native start
Open index.js file and check AppRegistry.registerComponent()
function
The component used in the function should be exported from App.js(or some other file mentioned in import
statement) using export
Try using the cli
list devices , run :
emulator -list-avds
Run an emulator (here Pixel_2_API_30) like
emulator -avd Pixel_2_API_30
emulator
command not foundRun emulator from its installed directory or add its path to system path
It is installed with android Sdk which can be at ~/android/Sdk/emulator/emulator
or /android/Sdk/emulator/emulator
Run
~/android/Sdk/emulator/emulator -avd Pixel_2_API_30
where Pixel_2_API_30 is name of emulator displayed when running emulator -list-avds
Run emulator from its installed directory
It is installed with android Sdk which can be at ~/android/Sdk/emulator/emulator
or /android/Sdk/emulator/emulator
Run
~/android/Sdk/emulator/emulator -avd Pixel_2_API_30
where Pixel_2_API_30 is name of emulator displayed when running emulator -list-avds
This can happen if emulator is not run from installed directory (although emulator is expected to run from other directories)
Run emulator by providing its full path
It is installed with android Sdk which can be at ~/android/Sdk/emulator/emulator
or /android/Sdk/emulator/emulator
Run
~/android/Sdk/emulator/emulator -avd Pixel_2_API_30
where Pixel_2_API_30 is name of emulator displayed when running emulator -list-avds
kvm is required for hardware acceleration and user running emulator command should have access to /dev/kvm
Use chown
command to change owner for directory to user
sudo chown user_name /dev/kvm
where user_name is of user who is to execute emulator command
Check if directory permission persists over restarts