We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Build Errors

Hello, I have just started using Syncfusion and I am encountering some build errors.

I have added

syncfusion_flutter_pdfviewer: ^20.4.49

to my pubspec.yaml file.


If I do a pub get and build, this works fine but as soon as I add the import statement to one of my files

import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';

Then I encounter the following build errors:

Launching lib/main.dart on iPhone 14 Pro Max in debug mode...

Running Xcode build...

Xcode build done. 21.4s

Failed to build iOS app

Error output from Xcode build:

** BUILD FAILED **



Xcode's output:

Writing result bundle at path:

/var/folders/rx/5gqz9nfd4_qccx74mj8lnnj00000gn/T/flutter_tools.18rjpi/flutter_ios_build_temp_dirti6TnV/temporary_xcresult_bundle


../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.49/lib/src/pdfviewer.dart:1016:54: Error: Method 'readState' cannot be called on 'PageStorageBucket?' because it is potentially null.

- 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../sdk/flutter/packages/flutter/lib/src/widgets/page_storage.dart').

Try calling using ?. instead.

final dynamic offset = PageStorage.of(context).readState(context);

^^^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.49/lib/src/pdfviewer.dart:1020:12: Error: Method 'readState' cannot be called on 'PageStorageBucket?' because it is potentially null.

- 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../sdk/flutter/packages/flutter/lib/src/widgets/page_storage.dart').

Try calling using ?. instead.

.readState(context, identifier: 'zoomLevel_${widget.key}');

^^^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.49/lib/src/pdfviewer.dart:3244:35: Error: Method 'writeState' cannot be called on 'PageStorageBucket?' because it is potentially null.

- 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../sdk/flutter/packages/flutter/lib/src/widgets/page_storage.dart').

Try calling using ?. instead.

PageStorage.of(context).writeState(

^^^^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdfviewer-20.4.49/lib/src/pdfviewer.dart:3272:35: Error: Method 'writeState' cannot be called on 'PageStorageBucket?' because it is potentially null.

- 'PageStorageBucket' is from 'package:flutter/src/widgets/page_storage.dart' ('../sdk/flutter/packages/flutter/lib/src/widgets/page_storage.dart').

Try calling using ?. instead.

PageStorage.of(context).writeState(

^^^^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_pdf-20.4.49/lib/src/pdf/implementation/forms/pdf_xfdf_document.dart:38:35: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.

- 'Object' is from 'dart:core'.

builder.attribute('rel='nofollow' href', _pdfFilePath);

^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.49/lib/src/widgets/interactive_scroll_viewer.dart:59:9: Error: Type 'PanAxis' not found.

final PanAxis panAxis;

^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.49/lib/src/widgets/interactive_scroll_viewer.dart:15:22: Error: Undefined name 'PanAxis'.

this.panAxis = PanAxis.free,

^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.49/lib/src/widgets/interactive_scroll_viewer.dart:59:9: Error: 'PanAxis' isn't a type.

final PanAxis panAxis;

^^^^^^^

../sdk/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_core-20.4.49/lib/src/widgets/interactive_scroll_viewer.dart:299:9: Error: No named parameter with the name 'panAxis'.

panAxis: widget.panAxis,

^^^^^^^

../sdk/flutter/packages/flutter/lib/src/widgets/interactive_viewer.dart:61:3: Context: Found this candidate, but the arguments don't match.

InteractiveViewer({

^^^^^^^^^^^^^^^^^

Failed to package /Applications/Dev/LockDown/flutter.

Command PhaseScriptExecution failed with a nonzero exit code

note: Building targets in dependency order

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'PromisesObjC' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleUtilities' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'nanopb' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'KeychainSwift' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'SDWebImage' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'SwiftyGif' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'FirebaseCoreInternal' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'FirebaseCore' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'FirebaseInstallations' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'GoogleDataTransport' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'DKPhotoGallery' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'DKPhotoGallery-DKPhotoGallery' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'DKImagePickerController' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'DKImagePickerController-DKImagePickerController' from project 'Pods')

/Applications/Dev/LockDown/flutter/ios/Runner.xcodeproj: warning: The Copy Bundle Resources build phase contains this target's entitlements file '/Applications/Dev/LockDown/flutter/ios/Runner/Runner.entitlements'. (in target 'Runner' from project 'Runner')

/Applications/Dev/LockDown/flutter/ios/Runner.xcodeproj: warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Applications/Dev/LockDown/flutter/ios/Runner/Info-debug.plist'. (in target 'Runner' from project 'Runner')

warning: Run script build phase 'Validate PDFTron License Key' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

warning: Run script build phase 'Set GoogleService-Info.plist' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')

/Applications/Dev/LockDown/flutter/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'PDFNet' from project 'Pods')


Result bundle written to path:

/var/folders/rx/5gqz9nfd4_qccx74mj8lnnj00000gn/T/flutter_tools.18rjpi/flutter_ios_build_temp_dirti6TnV/temporary_xcresult_bundle

Could not build the application for the simulator.

Error launching application on iPhone 14 Pro Max.



flutter --version

Flutter 3.3.3 • channel stable • https://github.com/flutter/flutter.git

Framework • revision 18a827f393 (4 months ago) • 2022-09-28 10:03:14 -0700

Engine • revision 5c984c26eb

Tools • Dart 2.18.2 • DevTools 2.15.0


4 Replies 1 reply marked as answer

LA Lavanya Anaimuthu Syncfusion Team February 9, 2023 06:13 AM UTC

Hi Alec Haas,


The reported issue is caused by a recent upgrade to the Flutter version. In previous versions, the alignPanAxis property was a Boolean, but in version 3.7.0, it was changed to an enum type. To resolve this issue, upgrade the Flutter SDK to version 3.7.0, as all the Syncfusion Flutter packages have been updated to this version. The framework breaking change PR can be found below for your reference.


https://github.com/flutter/flutter/pull/109014/commits/1c6f20c8b3dc8e10258a626d401161db2942ddca




Regards,

Lavanya A.



AH Alec Haas replied to Lavanya Anaimuthu February 9, 2023 02:18 PM UTC

Hello, I have upgraded to flutter 3.7.0 but I am still getting an error message. 




When I attempt to run on ios: 

Launching lib/main.dart on iPhone 14 Plus in debug mode...

Running pod install...

Running Xcode build...

Xcode build done. 112.6s

Failed to build iOS app

Error (Xcode): /Users/alechaas/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdf-20.4.49/lib/src/pdf/implementation/forms/pdf_xfdf_document.dart:38:35: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.

Could not build the application for the simulator.

Error launching application on iPhone 14 Plus.




When I attempt to run on android:

Launching lib/main.dart on sdk gphone x86 in debug mode...

Running Gradle task 'assembleDevDebug'...

/Users/alechaas/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdf-20.4.49/lib/src/pdf/implementation/forms/pdf_xfdf_document.dart:38:35: Error: The argument type 'String?' can't be assigned to the parameter type 'Object' because 'String?' is nullable and 'Object' isn't.

 - 'Object' is from 'dart:core'.

        builder.attribute('rel='nofollow' href', _pdfFilePath);

                                  ^

Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:

Script '/Applications/Dev/LockDown/sdk/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1151

* What went wrong:

Execution failed for task ':app:compileFlutterBuildDevDebug'.

> Process 'command '/Applications/Dev/LockDown/sdk/flutter/bin/flutter'' finished with non-zero exit value 1

* 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 1m 10s

Exception: Gradle task assembleDevDebug failed with exit code 1




flutter --version

Flutter 3.7.0 • channel unknown • unknown source

Framework • revision b06b8b2710 (2 weeks ago) • 2023-01-23 16:55:55 -0800

Engine • revision b24591ed32

Tools • Dart 2.19.0 • DevTools 2.20.1



AH Alec Haas February 10, 2023 01:00 AM UTC

I found a solution to my problem. The problem is I had other dependencies that were messing with the syncfusion package. 


syncfusion_flutter_pdf-20.4.49 depends on lints 2.0.1. 

lints package was at version 1.0.1 in my project due to another package that was using it as well. I forced lints to be 2.0.1 in my pubspec.yaml file and was able to find which other packages I had to update so that my project could use lints 2.0.1.


May be a better way to compare dependencies but I did it by making a new flutter project that only depended on syncfusion_flutter_pdf-20.4.49 and seeing which packages it pulled in at what versions, then compared those to my own project. 


Marked as answer

LA Lavanya Anaimuthu Syncfusion Team February 10, 2023 08:39 AM UTC

Hi Alec Haas,


Good to know you have resolved the issue. Kindly get back to us if you have further queries. We are always happy to assist you.


Regards,

Lavanya A.


Loader.
Up arrow icon