Flutter doesn't compile because lsq_solverno.dart doens't exist - dart

I am getting an issue trying to compile an application in the flutter dev channel, I have tried with master channel too, but it doesn't work.
I got this issue:
Your application could not be compiled, because its dependencies could not be established.
The following Dart file:
C:\src\flutter\packages\flutter\lib\gestures.dart
...refers, in an import, to the following library:
C:\src\flutter\packages\flutter\lib\src\gestures\lsq_solverno.dart
Unfortunately, that library does not appear to exist on your file system.
I have this YAML file
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
google_sign_in: ^3.0.4
http: ^0.11.3+16
cached_network_image: ^0.4.1
share: ^0.5.2
graphql_flutter: ^0.9.4
camera: ^0.2.1
shared_preferences: ^0.4.3
redux: ^3.0.0
flutter_redux: ^0.5.2
material_design_icons_flutter: ^3.0.3392
vibrate: ^0.0.4
I also tried to run the flutter_gallery project from Flutter GitHub examples, it ran the first time, but now, it indicates the same issue that I am getting with my project.

The correct file name would be
C:\src\flutter\packages\flutter\lib\src\gestures\lsq_solver.dart
instead of
C:\src\flutter\packages\flutter\lib\src\gestures\lsq_solverno.dart
Your Flutter installation is corrupted. You probably accidentally modified a File in the Flutter install directory.
You can run the following command from the Flutter install directory to check
git status
To fix run in the Flutter install directory
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor

Related

Codemagic build process for a Flutter app: Could not find a file named "pubspec.yaml"

I am using Codemagic for the iOS build process for a Flutter app.
In the pubspec.yaml I am referring to a package dependency by pointing to a public repository like so:
dependencies:
flutter:
sdk: flutter
flutter_circular_slider:
git: https://github.com/tomoehlrich/flutter-circular-slider.git
It all works with local debugging and when building an apk with "flutter build apk" on Windows.
Codemagic though keeps giving me the following error message in the build step "Installing dependencies":
== Install Flutter dependencies ==
> flutter packages pub get
Resolving dependencies...
Could not find a file named "pubspec.yaml" in https://github.com/tomoehlrich/flutter-circular-slider.git 5d6d0c54e93766b27d30707bf20042b26894561c.pub
finished with exit code 1
Build failed :|Failed to install dependencies
I had Codemagic working before. The difference now to the working version was that I was referencing a different repository on Github.
I am trying to figure out why the build process cannot find the pubspec.yaml in https://github.com/tomoehlrich/flutter-circular-slider.git but in another fork of the same flutter package on Github.
Any hints are highly appreciated.
It seems that "resolved-ref" in pubspec.lock for the slider package was an outdated reference.
A new generation of pubspec.lock, sync to GitHub and start a new build process in Codemagic did the trick.

Flutter pub get Flutter version mismatch | podfile.lock flutter version mismatch

I have updated my flutter version to 3.0.1 - Reference
I have one existing flutter project. When I hit flutter pub get command, inside ios/Flutter/Flutter.podspec file, it is showing flutter version 1.0.0.
s.version = '1.0.0'
Also in the iOS podfile.lock file is also showing flutter version 1.0.0. I tried updating pod, etc everything but same issue.
PODS:
Flutter (1.0.0)
Why it is showing 1.0.0 instead of 3.0.1. or this is not the correct way to check & update flutter version of existing project?
The flutter version depends on your environment (not the project), so you should be able to just run flutter --version to see which version you're running.
As for the project, it should normally build with any compatible flutter version. If you look at your pubspec.yaml, it should have the environment part which specifies the SDK. It should look something like the following to be compatible with the new Flutter version:
environment:
sdk: '>=2.17.0 <3.0.0'
I think (not entirely sure, though) that the 1.0.0 that you see is the app version, as specified in the pubspec.yaml version (usually right above the environment bit).

Plugin.h file not found: flutter and xcode

When I try and run my project in xcode, I am getting the following error:
'auto_orientation/AutoOrientationPlugin.h' file not found.
If I remove this plugin, it will then go to the next plugin and fail on the .h file for that plugin and so on for every single plugin.
Previously this issue only used to happen when I attempted to make an archive, but it would always run without issues. Now it will not even run.
There are many threads about this and I have run through these but have so far been unable to find any suggestion that is working.
Pubspec.yaml file, as requested:
name: app_name
description: My application.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 6.0.0
environment:
sdk: ">=2.3.0-dev.0.5 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: 0.1.2
firebase_admob: 0.5.5
screen: 0.0.5
image_picker: 0.6.1
firebase_auth: 0.11.1+7
shared_preferences: 0.4.3
rflutter_alert: 1.0.2
url_launcher: 5.0.3
in_app_purchase: 0.2.0
firebase_dynamic_links: 0.4.0+4
app_review: 1.1.0+1
auto_orientation: 1.0.4
vibration: 1.2.1
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
assets:
- lib/images/
- lib/images/example1.png
- lib/images/example2.png
- lib/images/example3.png
uses-material-design: true
Screenshot for Cenk:
you definitely do not need to wipe out your whole ios/ folder.
1) flutter cleancause why not
2) rm ios/Podfile.lock
3) rm -rf ios/Pods
4) rm -rf ~/.pub-cache/hosted/pub.dartlang.org/ (or wherever you set this up to live)
5) flutter packages get
then run/build your app however you normally do it.
Sometimes I also get ios compilation error in my project working properly, I create a clean project with the same name, copy my codes there and it gets better.
I suggest you try if you can't find a solution.
I have had such issues before. The error was because I deleted a package dependency from my pubspec.yaml. As we know deleting a package as such will remove all the flutter files it downloaded form pub.dev but forgot to delete the permission and method I added into Info.plist and AppDelegate.swift manually as dependencies for that package.
When Xcode see this methods in the AppDelegate.switf, it searches for the required files but it can't find them because the package was deleted from pubspec.yaml.
So cross-check if the content of those 2 files matches the packages that require them.
Hope it helps.
Edit
Based on your pubspec.yaml, they are some keys that need to be added to your AndroidManifest and info.plist files respectively. I assume you haven't done that from your comment.
Locations
AndroidManifist is found in android/app/src/main/AndroidManifiest.xml
info.plist is found in iso/Runner/Info.plist
For the firebase_admob package you need to add the following to your AndroidManifest
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
Where [ADMOD_APP_ID] is your App ID. Check firebase_admod to see how to initialize an app ID and how to initialize the plugin
Then you need to add the following to your info.plist
<key>GADApplicationIdentifier</key>
<string>[ADMOB_APP_ID]</string>
For screen 0.0.5 you need to add the following permission to your 'AndroidManifest`
<uses-permission android:name="android.permission.WAKE_LOCK" />
For image_picker: 0.6.1, you also need some permission added to the info.plist.
Add the following keys to your Info.plist file, located in /ios/Runner/Info.plist:
NSPhotoLibraryUsageDescription - describe why your app needs
permission for the photo library. This is called Privacy - Photo
Library Usage Description in the visual editor.
NSCameraUsageDescription - describe why your app needs access to the
camera. This is called Privacy - Camera Usage Description in the visual editor.
NSMicrophoneUsageDescription - describe why your app needs access to
the microphone if you intend to record videos. This is called Privacy
Microphone Usage Description in the visual editor.
Android No configuration required - the plugin should work out of the box
Not to be redundant, you need to browse you the package in you pubspec.yaml pub.dev page and follow the instruction to add all the dependencies for the packages to work.
I hope you project compiles now!
I guess you have some files missing for some reason.
I hope this steps maybe solve it:
backup your flutter project folder
delete "ios" folder from your your flutter project
run flutter create -i swift , this command will recreate new 'ios' folder
run your flutter project
In the end I found a fix for this in another forum:
Seems like by opening up the project by double clicking Runner.xcworkspace instead of Runner.xcodeproj xcode can finally figure out where everything is.
I tried this and it literally works. Now my app will run with a new error (because of course):
malloc: can't allocate region securely
But I will make a new question for that one.

Flutter: Unable to connect package geolocation

I can not connect the package to pubspect.yaml geolocation
dependencies:
http: ^0.12.0
flutter:
sdk: flutter
geolocation: ^0.2.1
Appear an error:
[logining] flutter packages get
Running "flutter packages get" in logining...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because logining depends on geolocation >=0.1.1 which requires SDK version <2.0.0, version solving failed.
pub get failed (1)
exit code 1
What should I do?
pub.dartlang.org prominently shows that this package is not compatible with Dart 2.
Flutter uses Dart 2 since about 5/2018, so you can't use this package with newer Flutter version.

Flutter dart dependency issue

I need to have a webview inside my context body, but not to cover the entire screen space as I have to display a listview below it.
I checked flutter_webview_plugin but it did not work
Getting the error :
That library is in a package that is not known. Maybe you forgot to mention it in your pubspec.yaml file?
dependencies:
flutter:
sdk: flutter
url_launcher: ^0.4.1
async_loader: "^0.1.1"
json_annotation: ^0.2.2
flutter_webview_plugin: "^0.1.5"
cupertino_icons: ^0.1.0
#url_launcher: ^3.0.0
dev_dependencies:
flutter_test:
sdk: flutter
json_serializable: ^0.4.0`
I have written below line in my dart file
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
If you add a new package to your dependencies, then do a hot reload, you get the following misleading message:
Performing hot reload...
Your application could not be compiled, because its dependencies could not be
established.
The following Dart file:
/usr/local/google/home/ianh/dev/release/startup_namer/lib/main.dart
...refers, in an import, to the following library:
package:package:flutter_webview_plugin/flutter_webview_plugin.dart
That library is in a package that is not known. Maybe you forgot to mention it in
your pubspec.yaml file?
Try again after fixing the above error(s).
Kill your application and start it again. This might solve your issue.
For more references please visit this git hub discussion
Go to the build directory, which will be located at the top level of your app along with lib, ios, android, etc.
If a flutter_webview_plugin folder is not there, then you need to run flutter pub get to download the package.
If the folder is there, then it has already been downloaded. If that is the case and your IDE is still telling you that it does not recognize the package, then try restarting your IDE.

Resources