Some issues (which can be) related to flutter are mentioned
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
Check if any of the following options is of any assistance
Replace connectivity
with package name for which pub get fails, in the command
https://pub.dartlang.org/api/packages/connectivity
Enter it in a browses and check if a json is returned
If commands were running previously and stopped working recently then this can also be a temporary issue and can continue for hours before working suddenly
Trying restarting internet connection including router/wifi source
Check if setting an alternate pub server works
setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"
Check if changing DNS is of any help
To change dns check guide in cloudflare website
Check if any of the following options is of any assistance
Replace connectivity
with package name for which pub get fails, in the command
https://pub.dartlang.org/api/packages/connectivity
Enter it in a browses and check if a json is returned
If commands were running previously and stopped working recently then this can also be a temporary issue and can continue for hours before working suddenly
Trying restarting internet connection including router/wifi source
Check if setting an alternate pub server works
setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"
Check if changing DNS is of any help
To change dns check guide in cloudflare website
Check if any of the following options is of any assistance
Replace connectivity
with package name for which pub get fails, in the command
https://pub.dartlang.org/api/packages/connectivity
Enter it in a browses and check if a json is returned
If commands were running previously and stopped working recently then this can also be a temporary issue and can continue for hours before working suddenly
Trying restarting internet connection including router/wifi source
Check if setting an alternate pub server works
setx PUB_HOSTED_URL "https://pub.flutter-io.cn"
setx FLUTTER_STORAGE_BASE_URL "https://storage.flutter-io.cn"
Check if changing DNS is of any help
To change dns check guide in cloudflare website
Try updating ca certificates
sudo apt-get install -y ca-certificates
sudo update-ca-certificates
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)
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
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