flutter 'file not found' during build for ios - flutter

I'm trying to use the image_picker_web package,(https://pub.dev/packages/image_picker_web) and have put:
image_picker_web: ^1.0.9
in my pubspec.yaml file.
When I try building my project for iOS, I get the following error:
[ios/.symlinks/plugins/image_picker_web/example] flutter pub get
Running "flutter pub get" in example...
Cannot open file, path = '/Users/username/.pub-cache/global_packages/image_picker_web_example/pubspec.lock' (OS Error: No such file or directory, errno = 2)
pub get failed (66; Cannot open file, path = '/Users/username/.pub-cache/global_packages/image_picker_web_example/pubspec.lock' (OS Error: No such file or directory, errno = 2))
exit code 66
With no other code in the project that uses that package, I get the same error. The only way to avoid it is to comment out image_picker_web: ^1.0.9 in my pubspec.yaml and run 'flutter pub get'
I created an issue in their git repo, under the assumption that it's a bug. Is this the case? Are there any workarounds? (perhaps ignoring a package when building for a different platform?)

I ran the following command to fix a similar issue.
Remove all existing caches
sudo rm -rf ~/.pub-cache
Repair the cache
flutter pub cache repair
Reinstall the dependencies
flutter packages get

Related

Getting an error from "Pub get" on android studio

I recently updated dart and flutter and after that I am getting this error when trying
Pug Get:
C:\flutter\flutter\bin\flutter.bat --no-color pub upgrade
Resolving dependencies...
Git error. Command: `git fetch`
stdout:
stderr: fatal: unable to connect to github.com:
github.com[0: 140.82.113.3]: errno=Unknown error
exit code: 128
pub finished with exit code 69
Process finished with exit code 69
I am not sure how to fix this? thank you in advance!
There is an issue with the URL to one of the packages in your pubspec. You can see more info on which repository is giving the error by running flutter pub get -v.
This occurred to me as Github has removed git native transport via git://. I had to change my git pubspec entries to
package_name:
git:
url: https://github.com/Sub6Resources/flutter_html.git
flutter pub upgrade
flutter pub get
These command needs to be run from inside a project folder, not from inside the folder flutter\bin\, where the flutter installation lives.

Could not find a file named "pubspec.yaml"

hi friends how to solve this error,i'm just running this command flutter:
Flutter doctor -v,
flutter pub cache clean ,
flutter pub cache repair,
flutter packages pub get,
flutter clean,
dart pub get ,
flutter pub get,
i'm getting an error
Could not find a file named "pubspec.yaml" in "E:\flutter.pub-cache\hosted\pub.dartlang.org\test_api-0.4.8".
Running "flutter pub get" in flutter_tools...
pub get failed (66; Could not find a file named "pubspec.yaml" in
"E:\flutter.pub-cache\hosted\pub.dartlang.org\test_api-0.4.8".)
I had this same issue. Really frustrating.I deleted the pub.dartlang.org folder.
On Mac, in finder command + shift + G | pasted the path from the console | opened in finder and removed the folder.
after deleting the folder
run
Pub get
pub outdated / upgrade
pod repo update
pod update
This fixed my issue and allowed me to build the app.

Pub failed to rename directory because access was denied

Whenever I run flutter doctor or flutter pub get, I am getting the following error
Pub failed to rename directory because access was denied.
This may be caused by a virus scanner or having a file in the directory open in another application.
Running "flutter pub get" in flutter_tools...
pub get failed (1; in the directory open in another application.)
I have tried some commands, ran the commands in administrator mode, but still getting the same error.
For me it helped to delete the 'pubspec.lock' file in the project folder and the run flutter pub get again
The source of my problem was that I had flutter installed directly in the C directory. After moving it to another directory (worked for me under MyUser/Downloads) the problem was solved.
I also faced a similar problem.
so, running flutter clean in terminal solved the problem.
I have deactivated my Anti-Virus and it worked for me! - Deactivate Antivirus

Should .packages files be auto-generated for pub packages cached from git?

The reason I'm asking it that I'm working on a package, actually flutter plugin and when I reference it local in my apps pubspec.yaml using path: everything works fine and I can see a .packages file being generated inside the local plugin workdir. Now if I now try to reference the plugin using git: in my apps pubspec, flutter pub get is happy BUT when I try to run the app, the build fails with an error mesg:
Launching lib/main.dart on XYZ in debug mode...
/home/maksimlin/.pub-cache/git/edit_exif-3c87efc135c1269b5961ff73696a19e988132ad7/.packages does not exist.
Did you run "flutter pub get" in this directory?
FAILURE: Build failed with an exception.
* Where:
Script '/home/maksimlin/fvm/versions/dev/packages/flutter_tools/gradle/flutter.gradle' line: 896
* What went wrong:
Execution failed for task ':edit_exif:compileFlutterBuildDebug'.
> Process 'command '/home/maksimlin/fvm/versions/dev/bin/flutter'' finished with non-zero exit value 1
and sure enough if I copy the .packages autogenerated file from my local plugin workdir into the the pub-cache location my app builds fine
So is something broken with pub auto-generating .packages for cached from git packages? or have I done something wrong with my plugin?
Unfortunately I can't seem to find much (any) documentation on the usage of .package files, especially for cached packages.
# Generated by pub on 2020-10-01 15:23:17.745081.
args:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib/
bloc:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/bloc-4.0.0/lib/
characters:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0-nullsafety.2/lib/
charcode:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.3/lib/
charts_common:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/charts_common-0.9.0/lib/
cloud_firestore:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.14.0/lib/
cloud_firestore_platform_interface:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-2.0.0/lib/
cloud_firestore_web:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_web-0.2.0/lib/
collection:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0-nullsafety.2/lib/
convert:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib/
crypto:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.5/lib/
custom_switch:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/custom_switch-0.0.1/lib/
dio:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/dio-3.0.10/lib/
easy_localization:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/easy_localization-2.3.3/lib/
file:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/file-5.2.1/lib/
firebase:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase-7.3.0/lib/
firebase_auth:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.0/lib/
firebase_auth_platform_interface:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-2.0.0/lib/
firebase_auth_web:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_web-0.3.0/lib/
firebase_core:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.5.0/lib/
firebase_core_platform_interface:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_platform_interface-2.0.0/lib/
firebase_core_web:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-0.2.0/lib/
flutter:file:///C:/Src/flutter/packages/flutter/lib/
flutter_bloc:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_bloc-4.0.1/lib/
flutter_localizations:file:///C:/Src/flutter/packages/flutter_localizations/lib/
flutter_web_plugins:file:///C:/Src/flutter/packages/flutter_web_plugins/lib/
google_fonts:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/google_fonts-1.1.0/lib/
http:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.2/lib/
http_parser:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib/
intl:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.16.1/lib/
js:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.2/lib/
logging:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.4/lib/
matcher:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.9/lib/
material_design_icons_flutter:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/material_design_icons_flutter-4.0.5245/lib/
meta:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.2/lib/
nested:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/nested-0.0.4/lib/
path:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety/lib/
path_provider:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/lib/
path_provider_linux:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/lib/
path_provider_macos:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/lib/
path_provider_platform_interface:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_platform_interface-1.0.2/lib/
pedantic:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.9.2/lib/
platform:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/platform-2.2.1/lib/
plugin_platform_interface:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/plugin_platform_interface-1.0.2/lib/
process:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/process-3.0.13/lib/
provider:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-4.3.2/lib/
quiver:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.1.3/lib/
shared_preferences:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/lib/
shared_preferences_linux:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/lib/
shared_preferences_macos:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/lib/
shared_preferences_platform_interface:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_platform_interface-1.0.4/lib/
shared_preferences_web:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/lib/
sky_engine:file:///C:/Src/flutter/bin/cache/pkg/sky_engine/lib/
source_span:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.7.0/lib/
stack_trace:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.5/lib/
string_scanner:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.5/lib/
term_glyph:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib/
typed_data:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0-nullsafety.2/lib/
vector_math:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0-nullsafety.2/lib/
xdg_directories:file:///C:/Src/flutter/.pub-cache/hosted/pub.dartlang.org/xdg_directories-0.1.0/lib/
website:lib/
This is my .package file here you can see that there is every package that I have used to along with directory(file:///C:/Src/flutter is my directory).
.package is an autogenerated file so you can delete the older one and run flutter pub get so it will generate a newer one.

pub get failed (66; Could not find a file named "pubspec.yaml" in "C:\Windows\System32"

fatal: not a git repository (or any of the parent directories): .git Could not find a file named "pubspec.yaml" in "C:\Windows\System32". pub get failed (66; Could not find a file named "pubspec.yaml" in "C:\Windows\System32".)
hi everyone
I got this error message every time when I tried to create a flutter project by an android studio or by cmd
I checked flutter doctor command and appear no problems about flutter installation
so any advice about this problem?
[error message when I used android studio 1
flutter doctor message
You can try below steps:
First, you reboot(restart) your PC.
Before opening anything, you delete your flutter folder.
Unzipped a new flutter installation into the same directory.
Inside your project directory You run flutter packages get
Then open the IDE and everything will be working.
Refer flutter issue for more information.