Closed DivyamDh closed 3 months ago
Hi DivyamDh,
We tried to reproduce the reported issue with provided details, but the PDF is loaded properly without any exception on our end. For your reference, we have prepared the sample and it can be downloaded from the following link, https://www.syncfusion.com/downloads/support/directtrac/general/ze/github1201699423.zip
If you still reproduce the reported issue in your use case, then kindly share the modified issue reproducing in sample and also, please share the following details, to reproduce the reported issue on our end.
This information will be helpful for us to provide you a prompt solution at the earliest.
Regards, Deepika Ravi
hi @deepika134 , I got the same error on firebase crashlytics, but I still can't reproduce on my devices (even with your sample).
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, Current page not closed, null, java.lang.IllegalStateException: Current page not closed
at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:269)
at android.graphics.pdf.PdfRenderer.close(PdfRenderer.java:184)
at com.syncfusion.flutter.pdfviewer.e.a(Unknown Source:13)
at com.syncfusion.flutter.pdfviewer.e.onMethodCall(Unknown Source:83)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(Unknown Source:17)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(Unknown Source:18)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(Unknown Source:20)
at io.flutter.embedding.engine.dart.DartMessenger.a(Unknown Source:0)
at io.flutter.embedding.engine.dart.a.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7025)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
). Error thrown null.
at StandardMethodCodec.decodeEnvelope(message_codecs.dart:653)
at MethodChannel._invokeMethod(platform_channel.dart:296)
at PdfViewerPlugin.closeDocument(pdfviewer_plugin.dart:154)
Galaxy J7+ Galaxy Tab A (2016) Galaxy S21+ 5G Galaxy Note20 Ultra 5G POCO F3 Redmi 9 OnePlus 8 5G Redmi 9C
[✓] Flutter (Channel stable, 3.3.7, on macOS 13.0 22A380 darwin-arm, locale en-VN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.64.0)
[✓] VS Code (version 1.73.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
Having similar issue, reported in firebase crashlytics
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, Current page not closed, null, java.lang.IllegalStateException: Current page not closed
at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:269)
at android.graphics.pdf.PdfRenderer.close(PdfRenderer.java:184)
at bg.c.a(Unknown Source:13)
at bg.c.onMethodCall(Unknown Source:83)
at eh.k$a.a(Unknown Source:17)
at rg.c.l(Unknown Source:18)
at rg.c.m(Unknown Source:20)
at rg.c.h(Unknown Source:0)
at rg.b.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6647)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
). Error thrown null.
at StandardMethodCodec.decodeEnvelope(message_codecs.dart:653)
at MethodChannel._invokeMethod(platform_channel.dart:296)
at PdfViewerPlugin.closeDocument(pdfviewer_plugin.dart:154)
Platform: Android 8.1 Device: moto e5 go
[✓] Flutter (Channel stable, 3.3.1, on macOS 12.4 21F79 darwin-x64, locale en-RU)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] Connected device (4 available)
[✓] HTTP Host Availability
syncfusion_flutter_pdfviewer: ^20.2.44-beta
Can't reproduce either.
Will be glad to know if there are any updates on that issue.
Can I help in some way?
+1 for this error. It is showing on Firebase, same as above.
Kindly refer the following KB link for load a PDF document from the Firebase storage, https://www.syncfusion.com/kb/12757/how-to-load-a-pdf-document-from-firebase-storage-in-syncfusion-flutter-pdfviewer
Same error, reported in crashlytics
Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: PlatformException(error, Current page not closed, null, java.lang.IllegalStateException: Current page not closed
at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:269)
at android.graphics.pdf.PdfRenderer.close(PdfRenderer.java:184)
at na.c.a(Unknown Source:15)
at na.c.onMethodCall(Unknown Source:83)
at tb.l$a.a(Unknown Source:17)
at gb.c.l(Unknown Source:18)
at gb.c.m(Unknown Source:20)
at gb.c.i(Unknown Source:0)
at gb.b.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
). Error thrown null.
at StandardMethodCodec.decodeEnvelope(message_codecs.dart:653)
at MethodChannel._invokeMethod(platform_channel.dart:296)
at PdfViewerPlugin.closeDocument(pdfviewer_plugin.dart:154)
[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [versÆo 10.0.22621.1105], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2022 17.4.4)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2021.3)
[√] VS Code (version 1.74.3)
[√] Connected device (4 available)
[√] HTTP Host Availability
syncfusion_flutter_pdfviewer: ^20.4.38
This will help https://www.youtube.com/watch?v=gAUVz0U7eyA
syncfusion_flutter_pdfviewer: ^21.1.41
I have the same error but it comes random
Any idea?
Hi @POGTAAP ,
We tried to reproduce the reported issue with provided details, but the PDF is loaded properly without any exception on our end. For your reference, we have prepared the sample and it can be downloaded from the attachment. If you still reproduce the reported issue in your use case, then kindly share the modified issue reproducing in sample and also, please share the following details, to reproduce the reported issue on our end.
This information will be helpful for us to provide you a prompt solution at the earliest.
I'm experiencing an exception in syncfusion_flutter_pdfviewer 21.2.4 The pdf viewer is used inside showGeneralDialog. The exception is thrown when the dialog is colsed.
The exception is logged below:
Exception has occurred.
PlatformException (PlatformException(error, Current page not closed, null, java.lang.IllegalStateException: Current page not closed
at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:278)
at android.graphics.pdf.PdfRenderer.close(PdfRenderer.java:190)
at com.syncfusion.flutter.pdfviewer.SyncfusionFlutterPdfViewerPlugin.closeDocument(SyncfusionFlutterPdfViewerPlugin.java:229)
at com.syncfusion.flutter.pdfviewer.SyncfusionFlutterPdfViewerPlugin.onMethodCall(SyncfusionFlutterPdfViewerPlugin.java:99)
at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
))
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.9, on Microsoft Windows [Version 10.0.19045.2130], locale en-US)
This is taking an unexpectedly long time...[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.19)
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.69.2)
[√] Proxy Configuration
[√] Connected device (4 available)
[√] HTTP Host Availability
• No issues found!
Did anyone find a solution to this one? Because I have the same problem that randomly pops up for me and it crashes my app. I don't even know how to swallow that exception to avoid the crash.
For now, the only solution I could find was to fork the plugin and add a catch block for IllegalStateException
in SyncfusionFlutterPdfViewerPlugin.java
:
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
boolean closeDocument(String documentID) {
try {
Objects.requireNonNull(documentRepo.get(documentID)).renderer.close();
Objects.requireNonNull(documentRepo.get(documentID)).fileDescriptor.close();
documentRepo.remove(documentID);
} catch (IOException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
}
return true;
}
This is how to replicate it.
We tried to replicate the reported issue with provided details, but the PDF loaded properly without any exception on our side. For your reference, we have attached the sample and included a screen recording of the output, which can be downloaded from the attachment. Please review the shared sample. If the issue still occurs on your end, kindly provide us with the modified issue replicating sample. This will be helpful for us to provide prompt solution at earliest. Sample.zip
It is obviously complicated to replicate but the android documentation for this method says that it can throw this exception that you don't catch. So why not coding defensively and actually catch that exception to prevent it from bubbling up?
We are closing this issue since we don't have enough information to reproduce it. You can reopen this anytime and share the proper issue reproducing sample and the details to proceed further.
Getting this exception for a couple of users. No idea what is really causing it. Can someone please guide us ?