packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

[pdfx] Blocker issues with 2.9.0

Open emakar opened this issue 9 months ago β€’ 7 comments

  1. Android build failure
e: file:///Users/yauhen/.pub-cache/hosted/pub.dev/pdfx-2.9.0/android/src/main/kotlin/io/scer/pdfx/Messages.kt:211:98 No value passed for parameter 'forPrint'.
  1. SurfaceProducer is migrated incorrectly, see https://github.com/ScerIO/packages.flutter/pull/543#discussion_r2030716738
  2. ios build failure
Swift Compiler Error (Xcode): Cannot find type 'NSColor' in scope
/Users/yauhen/Development/packages.flutter/packages/pdfx/ios/Classes/Hooks.swift:2:10

proposed fixes:

  • android: #564
  • ios: #565

emakar avatar Apr 07 '25 08:04 emakar

working on it

emakar avatar Apr 07 '25 09:04 emakar

(2) confirmed when going background and then foreground - rendered surface disappears

emakar avatar Apr 07 '25 09:04 emakar

❗ Build Issues on Version 2.9.0 (iOS & Android)

Hi, I'm also encountering build issues after upgrading to pdfx: 2.9.0. These errors occur on both iOS and Android platforms.


πŸ“± iOS Build Error Output

Running pod install...                                             17.9s
Running Xcode build...
Xcode build done.                                                  29.9s
Failed to build iOS app

Swift Compiler Error (Xcode): Type of expression is ambiguous without a type annotation
β†’ /Users/XXXX/.pub-cache/hosted/pub.dev/pdfx-2.9.0/ios/Classes/Document.swift:78:17

Swift Compiler Error (Xcode): Cannot find type 'NSColor' in scope
β†’ /Users/XXXX/.pub-cache/hosted/pub.dev/pdfx-2.9.0/ios/Classes/Hooks.swift:2:10

Swift Compiler Error (Xcode): No exact matches in call to initializer
β†’ /Users/XXXX/.pub-cache/hosted/pub.dev/pdfx-2.9.0/ios/Classes/SwiftPdfxPlugin.swift:367:34

Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code
Encountered error while building for device.

⚠️ Cause:

This appears to be caused by the inclusion of NSColor in Hooks.swift, which is macOS-only. Since NSColor isn’t available on iOS (UIKit uses UIColor), Xcode throws an error during compilation.


πŸ€– Android Build Error Output

flutter build appbundle
--------------------------------------------------------------------------------------------------------
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

e: file:///Users/XXXX/.pub-cache/hosted/pub.dev/pdfx-2.9.0/android/src/main/kotlin/io/scer/pdfx/Messages.kt:211:98 
   No value passed for parameter 'forPrint'

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pdfx:compileReleaseKotlin'.
> Compilation error. See log for more 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 12s
Running Gradle task 'bundleRelease'...                             13.2s
Gradle task bundleRelease failed with exit code 1

⚠️ Cause:

The Messages.kt file seems to be missing a required argument (forPrint) in one of its function calls. This results in a Kotlin compilation failure during the Android build.


πŸ› οΈ Temporary Workaround

  • I’ve reverted back to pdfx: 2.8.0, which builds correctly on both platforms.
  • For iOS, wrapping NSColor logic in a platform check (#if os(macOS)) could resolve the Swift compile error.
  • For Android, the Kotlin function call needs to be updated to pass the missing forPrint parameter.

πŸ“Œ Summary

Version 2.9.0 of the pdfx package introduces breaking changes that prevent building for both iOS and Android. I recommend holding off on using 2.9.0 until these issues are resolved.

utrayn avatar Apr 07 '25 09:04 utrayn

@utrayn @SergeShkurko see https://github.com/ScerIO/packages.flutter/pull/564

emakar avatar Apr 07 '25 10:04 emakar

@utrayn @SergeShkurko @emakar see https://github.com/ScerIO/packages.flutter/pull/565

vicajilau avatar Apr 07 '25 12:04 vicajilau

Can this be resolved soon?

sydneyagcaoili avatar Apr 12 '25 14:04 sydneyagcaoili

This issue has been resolved on 2.9.1 version it can be closed @SergeShkurko

vicajilau avatar May 03 '25 06:05 vicajilau