Why am I getting this error when building flutter app for windows?
Asked Answered
D

3

6

I am trying to use my app as a windows desktop, but I get this error in the console:

Building Windows application...
CMake Error at flutter/ephemeral/.plugin_symlinks/native_pdf_renderer/windows/DownloadProject.cmake:179 (message):
Build step for pdfium failed: 1
Call Stack (most recent call first):
flutter/ephemeral/.plugin_symlinks/native_pdf_renderer/windows/CMakeLists.txt:16 (download_project)


Exception: Unable to generate build files

Tried to look for similar error but did not find something like this.

Darden answered 4/2, 2022 at 20:14 Comment(3)
does it happen only for this project? Could be an issue on native_pdf_rendererGoalie
see github.com/rbcprolabs/packages.flutter/issues/…Drumfire
Thanks, the solution worked.Darden
D
2

Before the pull request was merged, this is a known issue as mentioned in the comment.

The only way to solve this is by adding the line

set(PDFIUM_VERSION "4634" CACHE STRING "")

into your CMakeLists.txt file as mentioned here.

@hillelcoren It seems that the upstream repository has cleared out some of the release artifacts we were using. I've opened a pull request #241 to fix this but in the meantime you can also work around this by adding

set(PDFIUM_VERSION "4634" CACHE STRING "")

to your windows/cmakelists.txt file (you may need to run flutter clean after this).

There is also the .zip vs .tgz issue that you've spotted but this only affects the most recent pdfium versions, I was waiting for their release process to stabilize before pushing a PR to address this.

Currently, the pull request have been merged and should resolve the issue relating to this.

Debra answered 3/5, 2023 at 22:58 Comment(0)
F
1

In one project, the solution from @MαπμQμαπkγVπ.0 worked:

set(PDFIUM_VERSION "4634" CACHE STRING "")

However, in another project, I had to do the following:

Remove this line from CMakeLists.txt (if you already added it)

set(PDFIUM_VERSION "4634" CACHE STRING "")

Then, add this to your pubspec.yaml

dependency_overrides:
 printing:
  git:
   url: https://github.com/DavBfr/dart_pdf
   ref: master
   path: printing

I'm referring to this issue: github issue

Fontanel answered 7/9 at 23:53 Comment(0)
L
0

Run this command "Flutter doctor" and check whether you have visual studio build tool 16 2019.

flutter version 2.9 and later supports only visual studio build tool 17 2022.

upgrade your Visual Studio Build Tool version.

Lobelia answered 17/5, 2023 at 4:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.