Flutter run command error : FlutterView.send called on a detached view - dart

Can anyone tell me why my app is not installing at all and ending with the error message
Observatory connection never became ready.
the app was working perfectly fine until yesterday .
I have changed the channel to master yesterday in the command prompt and from then on the app never runs.
I even switched back to channel alpha but still no use.
I have attached a screenshot of the command prompt where the installation was stuck forever.
I am not so sure if I need to reinstall the flutter. I am worried if I uninstall the flutter now it may not configure properly and I might break it forever.
Please can someone tell me what exactly might have gone wrong.
Many Thanks,
Mahi

Instead of reinstall try with following: (Mac)
Set Path Variable: via following terminal command
export PATH=~/flutter/bin:$PATH;
that is bin folder path of flutter.
export PATH=[PATH_TO_FLUTTER_GIT_FOLDER]/bin:$PATH
https://flutter.io/setup-macos/#update-your-path
If above not worked. Check with the Dart version
dart --version
Install the latest dart version:
brew install dart --devel
Hope this helps others.

For Mac
open terminal
$ echo $PATH
it will show like this
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
it means you need to add flutter in to path
Open Finder presss command + shift + G
Put /etc/paths in dialog and press GO
Copy the file "paths" and paste it on desktop
Then open the pasted "paths" file from desktop
and add following line into end of the file "/flutter/bin"
Then copy that file and again paste it on /etc/paths
same like step no 2
it will ask you to replace or not
press replace
Now if you hit $ echo $PATH on terminal it will show
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/swagat/development/flutter/bin
Now your $flutter doctor will work perfectly

The solution is from Google Groups #Flutter-Dev
Thank you very much for your reply #Michael Thomsen.
I've tried what you have suggested and the details are as follows:
When I used flutter run -v command the command prompt output is as follows:
It was stuck for a while at waiting for port connection if I am not wrong.
So I've used AndroidStudio, File>Open and selected android/ folder to run the app then the gradle was showing an error:
Error:Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (25.2.0) and test app (25.4.0) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
I modified the build.gradle(Module:app) to show the correct version of 25.2.0 which was previously showing 25.4.0.
dependencies {
androidTestCompile 'com.android.support:support-annotations:25.2.0'
}
I just saved the changes inside android studio and the gradle sync completed without any errors.
Now I can run the app from inside Android Studio and also from IntelliJ IDE.
Thanks very much Michael this solved my problem.

Reinstalling flutter would be my starting point. If this problem persists, please post the output of $>flutter doctor and a description of what exactly leads to this error.

Related

Possibly corrupt gluon download - message "graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final” is damaged and can’t be opened

This might just be me doing something stupid but I'm getting a popup message on running java --version when I use the install: graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final
"graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final” is damaged and can’t be opened
Does anyone else have the same issue? I've switched to my Pentium MacMini, so it's not urgent; but I do need Java11 and not 17 due to a dependency issue.
The following versions all run correctly and were installed using the same procedure and I have set the necessary quarantine paths.
graalvm-ce-java11-22.3.1
graalvm-svm-java11-darwin-gluon-22.1.0.1-Final
graalvm-svm-java17-darwin-gluon-22.1.0.1-Final
openjdk11-openj9
graalvm-svm-java17-darwin-m1-gluon-22.1.0.1-Final
So it's only the ...-java11-...-m1...tar that gives the message.
I looked for an older m1 release, but 22.1.0.1 was the only one I could see.
The GraalVM build graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final downloaded from https://github.com/gluonhq/graal/releases works just fine.
When you use the GluonFX plugin, the first time you run mvn gluonfx:build you get prompted to add a password, just to remove the quarantine from it.
But if you want to run anything like /path/to/graalvm/bin/java -version before that, the folder is still under quarantine, that won't work, and you will get the error that you posted:
"graalvm-svm-java11-darwin-m1-gluon-22.1.0.1-Final” is damaged and can’t be opened
You just need to remove the quarantine yourself, running:
sudo xattr -r -d com.apple.quarantine /path/to/graalvm
See the open issue https://github.com/oracle/graal/issues/1724 for reference.

The flutter tool cannot access the file or directory. Unable to grant read/write permissions for the current user

This is the first time I am installing flutter on the mac. I have followed all the steps that are told in flutter.dev. After setting up the path in .zshrc, I get this strange error.
The flutter tool cannot access the file or directory.
Please ensure that the SDK and/or project is installed in a location that has
read/write permissions for the current user.
This is the .zshrc file looks like.
After running flutter doctor getting this.
Thanks in advance.
I encountered this issue when moving my project from windows to a Mac folder. It seems to be an issue with some extended attributes. Using the below command worked for me.
sudo xattr -c -r <project_folder_path>
I'm not sure about this but try it. go to the folder where you installed Flutter, click the folder with to fingers which will show options. got to {Get info} look down at the Sharing & Permission, make sure your current user has read and write.
I just hope this will fix your problem

Export flutter PATH makes docker cli and/or npm not working

I have the following problem.
I noticed that, once i installed flutter and added its path to my .zshrc file, like this
export PATH={$PATH}:/Users/matteo/Documents/flutter/bin
I have problems with docker and/or npm. (E.G. I get the error docker: command not found)
I tried moving my line of code in different places in my .zshrc file, and it seems like depending on where my line of code is placed, sometimes only docker is not found, sometimes only npm, sometimes both of them.
Are there any connection, maybe under the hood, between those 3 application?
My computer is a Macbook Pro with Big Sur 11.4 and M1 chip.
Thanks for help,
Matteo.
you are exporting the path the wrong way, you should add it as follows:
export PATH="$PATH:/Users/matteo/Documents/flutter/bin"
After you have updated the ".zshrc" file, run this command to ensure changes have been notified to OS
source ~/.zshrc
Reference: https://flutter.dev/docs/get-started/install/macos

How can I fix "Checking Dart SDK version... << was unexpected at this time" error in Flutter?

I am facing an issue any time I try to run any app or flutter command from the terminal, this is displayed: Checking Dart SDK version... << was unexpected at this time.
Not even flutter doctor works.
Nothing seems to work and it's so frustrating as it happened out of the blue. One moment everything was fine, now nothing works. Any help will be appreciated
I've resolved this error with the below steps:
Go to C:\Users\{Name}\.gradle} - Delete the .gradle directory.
Then Download and install the same flutter and dart SDK version in some other location and set the environment variables.
Example:
Environment variables Before :
("D:\FlutterExtractedFiles\flutter\bin")
("D:\FlutterExtractedFiles\flutter\bin\cache\dart-sdk\bin")`
Environment variables After :
("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin")
("C:\edgedownloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin\cache\dart-sdk\bin")
Then check the Android Studio event log
I've resolved this error by following these steps:
Go to folder C:....\Flutter\
Run this command: git reset --hard HEAD
This will restore the flutter SDK folder to its original state, so no need to reinstall the SDK.
Flutter reinstalled worked for me..
delete flutter folder in C directroy.
make a src folder in C: directory.
GoTo cmd and install flutter from official flutter github repoC:\src>git clone https://github.com/flutter/flutter.git -b stable
https://flutter.dev/docs/get-started/install/windows
run flutter doctor
set env path.
DONE
What worked in my case was deleting the .gradle file (C:\Users\USER.gradle) and reinstalling Flutter in another location and changing the PATH to it.
you should try this
restart your pc and delete the flutter folder in C directory then reinstall flutter and run flutter doctor
For me, the following steps resolved the problem:
Open cmd and run flutter doctor. (if there is an issue resolve them first.)
If not then change the flutter channel to dev. Whatever your channel is?. If this is the dev channel then change to master channel.
Again flutter doctor. If everything goes perfectly. then run your project. If it runs accordingly then again change to channel to stable.
I faced this error before, all I had to do was to:
Remove Flutter from my C directory.
Install Flutter from the official website.
Run Flutter doctor: flutter doctor
No need for changing the PATH or any further actions.
If it worked fine with you then you are all done!
I faced another error after it, related to the Dart SDK and solved it using this link
the key is to install Android SDK Command-line Tools, steps being:
Open Android Studio Tools Menu, SDK Manager In the window that comes
up there are inner panels, choose SDK Tools panel Tick Android SDK
Command-line Tools Choose Apply button near the bottom of the window
At that point, you will be prompted to accept the SDK license and the
command line tools will be installed. Your license issue should now be
resolved.
If your using Intelij and get the << error and none of the above work.
Delete the .intelij folder in your project and reopen the folder in intelij.
I faced this problem too and I've solved it by downloading SDK file again.

The Dart Analyzer could not be started in vscode

I just updated Dart version and then my vscode warning me everytime, "The Dart Analyzer could not be started".
How can i solve this issue ?
Thank's
solved..!
give permission to access the flutter folder.
for MAC
go to the security & privacy section
then select the files and folders
under your IDE,
give permission to access the Flutter folder
In my case I put the flutter folder inside the document
This problem is solved by uninstalling the Dart sdk manually from the computer, and re-install it.
If anyone face the same problem, please uninstall your dart sdk And install it again. Make sure you re-start your vscode IDE.
Hope this will helpful if you face the same problem.
--- Happy Coding ---
I had a permission issue. I just go through the log and seems unable to create .dart directory in the home folder.
Here is the solution:
- This solution for mac only
- cd ~
- cd ..
- whoami
- sudo chown {username} {userfolder}
In my case a simple restart of VSCode was needed - it seems as if there was a Dart update pending that VSCode did not notify me about.

Resources