Repository: flutter
Issue: Filename too long error on Linux Mint with file encryption
Labels: c: regression,platform-android,tool,t: gradle,P2,team-tool,triaged-tool

### Is there an existing issue for this?

- [X] I have searched the [existing infra issues](https://github.com/flutter/flutter/issues?q=is%3Aopen+is%3Aissue+label%3Ateam-infra)

### Type of Request

bug

### Infrastructure Environment

flutter run

### What is happening?

I have Linux Mint with /home/username encryption (default encryption provided as OS installation option).
Flutter is version 3.16. I tried using Android Studio and VS Codium both with Flutter plugin. Both produce the same error. 
I've used emulator of Pixel 7 API 34. Both flutter SDK, Andorid Studio/VS Codium and flutter project are placed within /home/username directory.

I'm not the only one to face this error, I've created question on StackOverflow and other developers also have the same problem, link to question:
https://stackoverflow.com/questions/77511262/cant-run-flutter-project-on-emulator-filename-too-long-error/77518558
Other user stated that encryption limits filename length in OS to 143 characters.

**If i run Flutter SDK in 3.13.9 version project runs without any problem** no matter if on Android Studio or VS Codium.

Logs:
flutter run --debug

<details>
<summary>Output log</summary>

```console
Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
startup failed:
/home/damian/dev_tools/flutter/packages/flutter_tools/gradle/build/classes/groovy/main/FlutterPlugin$_addTasksForOutputsAppLinkSettings_closure22$_closure48$_closure50$_closure51$_closure52$_closure53$_closure55$_closure57$_closure58.class (filename too long)

1 error


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':gradle:compileGroovy'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 31s
Running Gradle task 'assembleDebug'...                             32,6s
Exception: Gradle task assembleDebug failed with exit code 1


More details:
/home/damian/dev_tools/flutter/packages/flutter_tools/gradle/build/classes/groovy/main/FlutterPlugin$_addTasksForOutputsAppLinkSettings_closure22$_closure48$_closure50$_closure51$_closure52$_closur
e53$_closure55$_closure57$_closure58.class (filename too long)
[  +30 ms] 1 error
[ +122 ms] > Task :gradle:compileGroovy FAILED
[   +2 ms] :gradle:compileGroovy (Thread[included builds,5,main]) completed. Took 17.064 secs.
[        ] FAILURE: Build failed with an exception.
[   +6 ms] * What went wrong:
[        ] Execution failed for task ':gradle:compileGroovy'.
[        ] > Compilation failed; see the compiler error output for details.
[        ] * Try:
[        ] > Run with --debug option to get more log output.
[   +7 ms] > Run with --scan to get full insights.
[   +1 ms] * Exception is:
[        ] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':gradle:compileGroovy'.
[   +5 ms]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
[        ]      at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
[   +3 ms]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:140)
[   +2 ms]      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:128)
[  +10 ms]      at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
[        ]      at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
[        ]      at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
[   +2 ms]      at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
[        ]      at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
[   +1 ms]      at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
[   +6 ms]      at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
[   +4 ms]      at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
[        ]      at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
[   +2 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[  +12 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
[   +7 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
[   +7 ms]      at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
[   +6 ms]      at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:69)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:327)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:314)
[   +1 ms]      at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:307)
[   +3 ms]      at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:293)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:417)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:339)
[        ]      at org.gradle.execution.plan.DefaultPlanExecutor.process(DefaultPlanExecutor.java:96)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.executeWithServices(DefaultTaskExecutionGraph.java:140)
[        ]      at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:125)
[        ]      at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:39)
[   +8 ms]      at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:51)
[   +1 ms]      at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor$ExecuteTasks.call(BuildOperationFiringBuildWorkerExecutor.java:54)
[        ]      at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor$ExecuteTasks.call(BuildOperationFiringBuildWorkerExecutor.java:43)
[   +4 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[   +1 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[  +11 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[   +5 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[   +4 ms]      at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[        ]      at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
[        ]      at org.gradle.execution.BuildOperationFiringBuildWorkerExecutor.execute(BuildOperationFiringBuildWorkerExecutor.java:40)
[        ]      at org.gradle.internal.build.DefaultBuildLifecycleController.lambda$executeTasks$7(DefaultBuildLifecycleController.java:161)
[        ]      at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:247)
[        ]      at org.gradle.internal.model.StateTransitionController.lambda$tryTransition$7(StateTransitionController.java:174)
[        ]      at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44)
[        ]      at org.gradle.internal.model.StateTransitionController.tryTransition(StateTransitionController.java:174)
[  +16 ms]      at org.gradle.internal.build.DefaultBuildLifecycleController.executeTasks(DefaultBuildLifecycleController.java:161)
[        ]      at org.gradle.internal.build.DefaultBuildWorkGraphController$DefaultBuildWorkGraph.runWork(DefaultBuildWorkGraphController.java:156)
[        ]      at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249)
[        ]      at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109)
[        ]      at org.gradle.composite.internal.DefaultBuildController.doRun(DefaultBuildController.java:164)
[        ]      at org.gradle.composite.internal.DefaultBuildController.access$000(DefaultBuildController.java:45)
[  +32 ms]      at org.gradle.composite.internal.DefaultBuildController$BuildOpRunnable.run(DefaultBuildController.java:183)
[        ]      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[        ]      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[        ]      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[        ]      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[        ]      at java.base/java.lang.Thread.run(Thread.java:833)
[        ] Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
[  +14 ms]      at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:276)
[        ]      at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:64)
[        ]      at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:97)
[        ]      at org.gradle.api.internal.tasks.compile.GroovyCompilerFactory$DaemonSideCompiler.execute(GroovyCompilerFactory.java:76)
[        ]      at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerWorkAction.execute(AbstractDaemonCompiler.java:135)
[        ]      at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
[  +19 ms]      at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
[        ]      at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
[        ]      at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
[        ]      at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
[        ]      at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
[        ]      at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
[        ]      at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:87)
[        ]      at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:56)
[        ]      at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
[        ]      at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
[        ]      at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
[        ]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[   +2 ms]      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[        ]      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[        ]      at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[        ]      at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
[        ]      at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
[        ]      at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
[        ]      at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
[        ]      at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
[        ]      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[        ]      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[        ]      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[        ]      at java.base/java.lang.Thread.run(Thread.java:833)
[        ] * Get more help at https://help.gradle.org
[  +10 ms] BUILD FAILED in 20s
[   +1 ms] 1 actionable task: 1 executed
[        ] Some of the file system contents retained in the virtual file system are on file systems that Gradle doesn't support watching. The relevant state was discarded to ensure changes to these
locations are properly detected. You can override this by explicitly enabling file system watching.
[  +42 ms] Stopped 1 worker daemon(s).
[ +642 ms] Running Gradle task 'assembleDebug'... (completed in 21,2s)
[+6474 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +4 ms] "flutter run" took 30 295ms.
[   +5 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:752:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1350: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:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:348: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:294:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:112: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:90:3)
           <asynchronous suspension>
```
</details>

### Steps to reproduce

1. On PC with Linux Mint 21.2 x86_64  create new Flutter project somewhere in /home/username directory.
2. You can leave default code or write your own - doesn't change anything.
3. Run project on Android device emulator.


### Expected results

I expect application to run properly on Linux Mint with file encryption  active using Flutter 3.16.'

### flutter doctor -v output
[✓] Flutter (Channel stable, 3.16.0, on Linux Mint 21.2 5.15.0-76-generic, locale pl_PL.UTF-8)
    • Flutter version 3.16.0 on channel stable at /home/damian/dev_tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision db7ef5bf9f (6 dni temu), 2023-11-15 11:25:44 -0800
    • Engine revision 74d16627b9
    • Dart version 3.2.0
    • DevTools version 2.28.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/damian/dev_tools/android_sdk/
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/damian/dev_tools/android_studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Linux toolchain - develop for Linux desktop
    ✗ clang++ is required for Linux development.
      It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/
    ✗ CMake is required for Linux development.
      It is likely available from your distribution (e.g.: apt install cmake), or can be downloaded from https://cmake.org/download/
    ✗ ninja is required for Linux development.
      It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from
      https://github.com/ninja-build/ninja/releases
    • pkg-config version 0.29.2
    ✗ GTK 3.0 development libraries are required for Linux development.
      They are likely available from your distribution (e.g.: apt install libgtk-3-dev)

[✓] Android Studio (version 2022.3)
    • Android Studio at /home/damian/dev_tools/android_studio
    • Flutter plugin version 76.3.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (2 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 14 (API 34) (emulator)
    • Linux (desktop)              • linux         • linux-x64   • Linux Mint 21.2 5.15.0-76-generic

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.