[pdfx] Blocker issues with 2.9.0
- 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'.
SurfaceProduceris migrated incorrectly, see https://github.com/ScerIO/packages.flutter/pull/543#discussion_r2030716738- 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
working on it
(2) confirmed when going background and then foreground - rendered surface disappears
β 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
NSColorlogic 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
forPrintparameter.
π 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 @SergeShkurko see https://github.com/ScerIO/packages.flutter/pull/564
@utrayn @SergeShkurko @emakar see https://github.com/ScerIO/packages.flutter/pull/565
Can this be resolved soon?
This issue has been resolved on 2.9.1 version it can be closed @SergeShkurko