Fail to build Flutter Linux desktop app in Android Studio (but works if built manually)
Tags: help, flutter
Published: 2020-08-08 01:30:13

So, I'm experimenting with Flutter for desktop, specifically in Linux.
The good news is **I'm able to run my app** on my Xubuntu 20.04 by running `flutter run -d linux` from the console. I repeat, this works just fine, there is not an issue with the Flutter installation, or my code, the app works, it's super simple, everything's fine.

The problem is with Android Studio, my IDE of choice since I also do native Android development. I select "Linux (desktop)" from the devices dropdown, click the green play button and... I get a pretty generic error: `Exception: Build process failed`

So then I add the `--verbose ` flag to the run/debug parameters and here's the interesting part:

```
[   +5 ms] Exception: Build process failed
[   +6 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:460:9)
           <asynchronous suspension>
           #2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:869:18)
           #3      _rootRunUnary (dart:async/zone.dart:1198:47)
           #4      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #5      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #7      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #8      Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #9      _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
           #10     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
           #11     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
           #12     _rootRunUnary (dart:async/zone.dart:1198:47)
           #13     _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #14     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #15     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #16     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #17     Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #18     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #19     _rootRun (dart:async/zone.dart:1190:13)
           #20     _CustomZone.run (dart:async/zone.dart:1093:19)
           #21     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #22     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #23     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #24     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #25     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #26     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)
```

This means **nothing** to me...

I have tried searching for bug reports and have found a [closed issue](https://github.com/flutter/flutter/issues/57641) in the Flutter repository which looks similar if not exactly the same, but from 5 months ago, but I don't have high hopes of getting an answer from there.

Can anyone help me debug this?

Thanks