The Dart Analyzer could not be started in vscode - dart

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.

Related

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

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.

ios Could not get BatchedBridge, make sure your bundle is packaged properly

I am getting this while running app on simulator using xCode, version 9.2
I've tried other solution mentioned on Stack overflow & Github S1S2 S3 S4 but most of the solution are mentioned for android.
P.S. This project also includes purescript code explained here Integrate Pure Script in your React Native project
That's how I resolved it.
Terminate your metro bundler > react-native link > react-native run-ios
It was not bundling because of some errors which was not showing in the simulator but just this error was thrown.
create index.js, index.android.js and index.ios.js whith the same content. I do have all of them and it solved my issue
I have also faced the same issue when I changed the name of images saved in my local directory. In my case, I have just restarted metro bundler, deleted the app, and restarted the app. Issue was fixed for me.
Try this:
npx react-native-asset
then:
react-native run-ios
This issue is caused basically when some packages or images are not bundled properly, it might be caused because of improper assets path or internet issue when installing packages or reload issue. The expo bundles into a standalone library so it can be available immediately.
This error does not provide any stack to debug since it does not properly have the bundled data even for error stack.
I have just face few bundled scenarios
Scenario 1 => While the expo is running and we install a new library on fly, few times during this importing the library might not get bundled properly, so it's better to stop the expo and re-run, or try reloading the error in app. This will some time resolve the issue, or if there is some error it will show up the error stack
Scenario 2 => You have a customised asset director or have changed the asset path in app.json file improperly.
Please let me know in comments if there are any other scenarios
I had a metro bundler terminal window opened and whenever I was running npm run ios , it wasn't starting a new metro server, the problem was that. I closed the metro bundler terminal window and ran npm run ios and it opened a started a new metro server and the error was gone
I had a same issue, then I did:
rm -rf node_modules,
npm install
and restarted the metro (npm start). It worked.
In Settings, go to Privacy > Local Network to see a list of every app that requested access. I solved by allowing my app to access to the local network. (Trying to run on physical iPhone device from my mac m1 on the same wifi).
Source
Make sure that when you restart the expo project you do so with expo start -c
-c throws out the cache, otherwise the problem persisted for me.

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

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.

React Native - launchPackager.command cant be opened

I am having trouble building react native ios project.
Error message:
"launchPackage command" can't be opened because it is from an unidentified developer.
Any idea how to fix this?
Although this answer will most likely work, you would also allow all future apps from unidentified developers to be installed without being prompted.
To allow executing only the command in question (launchPackager.command), go to your react-native installation folder (most likely node_modules/react-native/scripts) in Finder and right-click launchPackager.command, choose Open and confirm by clicking Open again.
You will not be prompted again for this command as you have allowed execution specifically.
Another simple way is to delete node_modules folder from project directory and do npm install.
This happened because project was copied from old mac which had node_modules folder created by that old mac user, hence some problem occurs for project transferred to new mac.
Had the same problem on macOS Mojave.
This helped:
chmod 777 node_modules/react-native/scripts/launchPackager.command
on MacOS Catalina and above
Go to
System Preferences
Security & Privacy
Choose tab "Privacy"
Select "Developer Tools" on left pane
Check "Terminal" to allow terminal to run software locally which does not meet system's security policy . (please be aware of potential implications of this action and make sure that you know what you are doing )
Go to
System Preferences
Security & Privacy
Choose tab General
Choose Allow apps downloaded from anywhere or Allow apps downloaded from App Store and identified developers
I had the same error with you and this method worked for me.
chmod 777 node_modules/react-native/scripts/launchPackager.command
open terminal and Run the above command
after that Run the react-native run-android
Works for Me, It will Run :)
The reason is because you downloaded source code using virtual machine.
Solution:
Please download source code at your real machine.
And then copy it at VM, and build this project.

Resources