0

I am trying to open a flutter app in the android studio on macOS. It has no error in the code. Everything is fine and well tested.

But when I run it fails to build the android .apk with the following error, which basically says error in permission on file or folder. But all of my file and folder has full access. Here point to be noted that any other new project doesn't have that problem at all. Only that project has this problem to open.

I have tried all other solutions in StackOverflow that did not work so I am posting it. Please help me on this I am stuck in the last 7 days. Thanks.

Exception: null. 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.
[  +35 ms] 
        #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
        #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:563:9)
        <asynchronous suspension>
        #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1043:27)
        <asynchronous suspension>
        #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
        <asynchronous suspension>
        #4      CommandRunner.runCommand (package:args/command_runner.dart:196:13)
        <asynchronous suspension>
        #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:284:9)
        <asynchronous suspension>
        #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
        <asynchronous suspension>
        #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:232:5)
        <asynchronous suspension>
        #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
        <asynchronous suspension>
        #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
        <asynchronous suspension>
        #10     main (package:flutter_tools/executable.dart:91:3)
        <asynchronous suspension>```
Appolonias
  • 88
  • 1
  • 8

1 Answers1

0

Short answer: Change the permission of the flutter SDK folder + the permission of the project

Long answer: Change the directory of my project from:

/media/sharyu/File/Projects/Android/flutter_app

with this permission

drwxrwxr-x 1 sharyu users 4096 May 26 18:37 flutter_app

to

/home/sharyu/flutter_app

with this permission

drwxrwxr-x 13 sharyu sharyu 4096 May 27 01:12 flutter_app