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

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

Related

Xcode file permission issue

I updated my MacOS to Catalina, after that I am getting error reading issue in one project only. Check below image
When I try to open the file in my xcode, I got below error.
If I opened the same file from finder, then it opens the same file in xcode successfully. And issue is shifted to other file. I tried 7-8 times and it continuously coming from one file to another.
Already tried
Open backup project and still getting same issue.
Tried with changing the folder directory, like copied project to desktop, but still getting issue
Cleaned and build the project,
Restart my mac.
Note: I am getting issue in one project and rest of my projects are working file.
Is there any one time solution for this issue?
This error message can occur (somewhat misleadingly) if Xcode does not have permissions to access your Documents folder, and your project references a file that is not located within the same folder path as the project file.
The error message is misleading because the issue is not "you" (a user) lacking permission to view the file. The issue is that Xcode doesn't have permission to access the location of the file.
To resolve, go to System Preferences, Security & Privacy, Files and Folders, and enable Xcode to access the Documents folder. (Current as of MacOS 10.15.4 and Xcode 11.4.1)
You can change the permission from the Finder, right click on that file, goto info and then on bottom under sharing and permission change the privilege to read and write against your username. This might solve your issue.
Try changing the permission if not already done.
Enter the following in your terminal:
sudo chmod -R 777 /Users/macmini1/Desktop/Classes
It will ask for your password and then you will good to go.

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.

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.

updated AIR SDK from 23 to 25 and i get error Error: Unable to access jarfile /../lib/mxmlc-cli.jar

I have just updated my AIR SDK from version 23 to 25.
When running the command mxmlc, the following error occurs:
Error: Unable to access jarfile /../lib/mxmlc-cli.jar
Solution 1:
Make sure you have downloaded the Flex SDK and not the AIR SDK.
In the download page, there's link specifying:
Flex users will need to download the original AIR SDK without the new compiler.
Solution 2:
When the Adobe AIR SDK is installed it is sometimes installing files with wrong permissions.
The mxmlc-cli.jar file your lib directory probably has a permissions issue.
Try giving this file full permission and making sure it's not read only and everything should work fine.
If you are using Windows, just right click the files and set up the proper permissions in the security tab, and make sure the file is not read only.
If you are using Unix / Linux, run the following:
$ su -
# cd [AIRSDK install directory]
# chmod -R go+rx *
If you are using Mac OS:
Click the mxmlc-cli.jar file or to select it.
From the File menu, select Get Info. One of the windows shown below
appears. Click the disclosure triangle next to Sharing & Permissions
to display the file's permissions.
Click the lock and authenticate with an administrator account. Use
the menus next to users and groups to change the permissions.
This is an old one, but I've faced this problem several times and the fix is really minor.
You have to edit mxmlc or compile.
In the file there is a row which should be changed to:
SCRIPT_HOME=`dirname "$0"`
The error comes from missing " " around the $0.

Resources