[tool_crash] FileSystemException: Exists failed, OS Error: Permission denied, errno = 13 #72232

@stanimirdim92

Description

Hello,

I'm having problems creating new flutter projects. The old projects are working fine. I have upgraded flutter to 1.22.5 and Dart SDK to 2.10.4 and activated them. Every time I open Android Studio (after upgrading everything) I get an error message Plugin Error: Plugin "Flutter App Template Generator" is incompatible (supported only in IntelliJ IDEA). . My Flutter plugin was upgraded to the latest version 52.0.1.

I have seen this issue #69262 , but since it was not resolved and no additional info was given I decided to open a new one.

  • All my projects are installed in /home/webdev/AndroidStudioProjects.
  • Running the command from bash or Android Studio terminal as root, creates the project.
  • Changing AndroidStudioProjects to root:root and running File -> New -> New Flutter Project, still doesn't work.
  • I'm on Flutter stable channel. Before upgrading (from 1.20) I didn't have this issue.
  • Android Studio is installed via snap.
  • java -version
    openjdk version "1.8.0_275"
    OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~18.04-b01)
    OpenJDK 64-Bit Server VM (build 25.275-b01, mixed mode)
  • Command

    flutter --no-color create --template app --description A new Flutter application --org uk.co.increate i_am_rich
    

    Steps to Reproduce

  • Open Android Studio 4.1 and go to File -> New -> New Flutter Project
  • Fill all the fields and click finish
  • Another way is to run the command from the terminal inside Android Studio.
  • Oops; flutter has exited unexpectedly: "FileSystemException: Exists failed, path =
    '/root/.pub-cache/hosted/pub.dartlang.org/flutter_template_images-1.0.1/lib/' (OS Error:
    Permission denied, errno = 13)".

    FileSystemException: Exists failed, OS Error: Permission denied, errno = 13

    #0      _Directory.existsSync (dart:io/directory_impl.dart:94:7)
    #1      ForwardingFileSystemEntity.existsSync (package:file/src/forwarding/forwarding_file_system_entity.dart:45:33)
    #2      ForwardingFileSystemEntity.existsSync (package:file/src/forwarding/forwarding_file_system_entity.dart:45:33)
    #3      _templateImageDirectory (package:flutter_tools/src/template.dart:304:79)
    <asynchronous suspension>
    #4      Template.fromName (package:flutter_tools/src/template.dart:77:38)
    #5      CreateCommand._renderTemplate (package:flutter_tools/src/commands/create.dart:791:46)
    #6      CreateCommand._generateApp (package:flutter_tools/src/commands/create.dart:671:29)
    #7      CreateCommand.runCommand (package:flutter_tools/src/commands/create.dart:436:37)
    #8      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:977:18)
    #9      _rootRunUnary (dart:async/zone.dart:1198:47)
    #10     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
    #11     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
    #12     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
    #13     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
    #14     Future._completeWithValue (dart:async/future_impl.dart:529:5)
    #15     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
    #16     _rootRun (dart:async/zone.dart:1190:13)
    #17     _CustomZone.run (dart:async/zone.dart:1093:19)
    #18     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
    #19     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
    #20     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
    #21     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
    #22     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
    #23     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
    
    [✓] Flutter (Channel stable, 1.22.5, on Linux, locale en_US.UTF-8)
        • Flutter version 1.22.5 at /home/webdev/flutter
        • Framework revision 7891006299 (3 days ago), 2020-12-10 11:54:40 -0800
        • Engine revision ae90085a84
        • Dart version 2.10.4
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
        • Android SDK at /home/webdev/Android/Sdk
        • Platform android-30, build-tools 30.0.0
        • Java binary at: /usr/lib/jvm/java-8-openjdk-amd64/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_275-8u275-b01-0ubuntu1~18.04-b01)
        • All Android licenses accepted.
    [!] Android Studio (not installed)
        • Android Studio not found; download from https://developer.android.com/studio/index.html
          (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
    [✓] Connected device (1 available)
        • 5059D (mobile) • 9DCIBY6SNN6L4DNN • android-arm • Android 8.1.0 (API 27)
    ! Doctor found issues in 1 category.
    

    Flutter Application Metadata

    No pubspec in working directory.