Newby Coder header banner

Issues while running React-native App


Some issues (which can be) related to flutter are mentioned

Run issues


Error: No pubspec.yaml file found

This can occur if flutter run command is run from a different directory than the root directory of an application

A root Flutter application directory typically has the following structure

some_app_name/
 |-- android/
 |-- build/
 |-- ios/
 |-- lib/
 |-- pubspec.lock
 |-- pubspec.yaml
 |-- README.md
 |-- test/

Check if running ls command shows pubspec.yaml and other mentioned file and folders

pub get failed (server unavailable)

Check if any of the following options is of any assistance

Could not resolve URL "https://pub.dartlang.org"

Check if any of the following options is of any assistance

flutter pub get - failed host lookup

Check if any of the following options is of any assistance

TLS error trying to find package at https://pub.dartlang.org

Try updating ca certificates

sudo apt-get install -y ca-certificates
sudo update-ca-certificates

adb ENOENT

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)


java.lang.NoClassDefFoundError: Could not initialize class

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


Android emulator

Unable to start emulator after creation from AVD manager

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 found

Run 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

PANIC: Missing emulator engine program for 'x86' CPU

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

Qt library not found at ../emulator/lib64/qt/lib

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

user doesn't have permissions to use KVM (/dev/kvm)

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