Flutter Windows Desktop app gets stuck on white screen after msix installation

3.7k Views Asked by At

Background

I just developed my first flutter desktop app for a windows machine. The app is working fine while developing/debugging it, but I am trying to test it as an application in release mode.

What’s done

  1. I created an msix using pub msix.
  2. For signing, I have tried both my own certificate and the test certificate that comes with msix packages by default.
  3. I have tried both stable and beta channels.

Actual Problem

When I install the app on the other system (or even on the actual system where I debugged the app). I can install the msix setup successfully I can see my app listed in the apps, but when I try to open it, it is stuck on a blank/white screen. There is no UI rendered. And if I try to maximize the window, it goes to App not responding state. Any help will be really appreciated. Thanks in advance.

Update / New Finding

After going through the links provided by Yehuda Kremer and pulling my hair for a few days, I found the answer in this tweet https://twitter.com/FilledStacks/status/1436280577439715338?s=20

So the main issue is that app is using some absolute paths that don't work on other machines (after release)

1- My app was using a database, so I have made sure that that database path is relative to the application document directory. 2- Now the build is also referring to some dependencies and their paths are also absolute. I have noticed a flag CMAKE_INSTALL_LOCAL_ONLY in the cmake_install.cmake but that flag is not being set anywhere.

Here is the log of flutter build windows -v https://pastebin.com/LAeshUMY

-- Now I am looking for a proper way to convert all the paths to relative so that the build is ready for installation on different machines, instead of local installation only.

2

There are 2 best solutions below

3
On BEST ANSWER

I have found the solution.

The main problem was that the app was looking for some dependencies and it was unable to find them. As mentioned here.

The reason for not finding that in release mode can be one of the following,

  • You are using some dll (package that depends on a dll) that is available on a specific path in your system, but when you are release the app that (absolute) path is not valid anymore.
  • You are adding some asset with absolute path (that is only applicable to your system).

Solution:

  • If it is a dll, you should be adding that to the release folder. In my case it was sqlite3.dll
  • If it is some other asset then you should always use the relative path.
0
On

You mentioned msix package, let see if the problem is in the app or in the packaging process

run flutter build windows without the flutter pub run msix:create, then run the created .exe file to see if its work.

btw this issue mention here: https://github.com/flutter/flutter/issues/74507

and here (the 'maximizing' problem): Black screen appears on maximizing and minimizing flutter desktop app