Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Methods marked with @UiThread must be executed on the main thread. #86

Open
kNoAPP opened this issue Oct 12, 2021 · 4 comments
Open

Methods marked with @UiThread must be executed on the main thread. #86

kNoAPP opened this issue Oct 12, 2021 · 4 comments

Comments

@kNoAPP
Copy link

kNoAPP commented Oct 12, 2021

I/System.out(31423): Already closed
W/System.err(31423): java.lang.IllegalStateException: Already closed
W/System.err(31423): 	at android.graphics.pdf.PdfRenderer.throwIfClosed(PdfRenderer.java:270)
W/System.err(31423): 	at android.graphics.pdf.PdfRenderer.close(PdfRenderer.java:187)
W/System.err(31423): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin.getPage(FlutterPluginPdfViewerPlugin.java:206)
W/System.err(31423): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin.access$100(FlutterPluginPdfViewerPlugin.java:31)
W/System.err(31423): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin$1.run(FlutterPluginPdfViewerPlugin.java:84)
W/System.err(31423): 	at android.os.Handler.handleCallback(Handler.java:883)
W/System.err(31423): 	at android.os.Handler.dispatchMessage(Handler.java:100)
W/System.err(31423): 	at android.os.Looper.loop(Looper.java:237)
W/System.err(31423): 	at android.os.HandlerThread.run(HandlerThread.java:67)
D/PdfViewerPlugin(31423): Retrieving page failed.
E/AndroidRuntime(31423): FATAL EXCEPTION: flutterPdfViewer
E/AndroidRuntime(31423): Process: net.vpl.one_on_one, PID: 31423
E/AndroidRuntime(31423): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: flutterPdfViewer
E/AndroidRuntime(31423): 	at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:1280)
E/AndroidRuntime(31423): 	at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageEmptyResponseCallback(FlutterJNI.java:933)
E/AndroidRuntime(31423): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:167)
E/AndroidRuntime(31423): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.notImplemented(MethodChannel.java:248)
E/AndroidRuntime(31423): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin$1.run(FlutterPluginPdfViewerPlugin.java:87)
E/AndroidRuntime(31423): 	at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime(31423): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime(31423): 	at android.os.Looper.loop(Looper.java:237)
E/AndroidRuntime(31423): 	at android.os.HandlerThread.run(HandlerThread.java:67)
I/ViewRootImpl@8602f9b[MainActivity](31423): MSG_WINDOW_FOCUS_CHANGED 0 1

Branch: develop

Device: Note 9, Android 10

Steps to reproduce:

PDFViewer(
  document: _doc!, // Any valid .pdf document
  lazyLoad: false,
  showPicker: false,
  showNavigation: false,
  scrollDirection: Axis.vertical,
  progressIndicator: const CupertinoActivityIndicator(),
),

This stack is thrown when opening any pdf document.

@dujardin-quentin
Copy link

Same issue since the update of android embedding (dev or https://github.com/enveraltin/pdf_viewer.git)

@enveraltin
Copy link

@kNoAPP @gtu-myowin is the file you're trying to open local or remote?

@gtu-myowin
Copy link

@enveraltin The crash happens for both local (Inside Application Documents Directory) and remote files.

@tomtitherington
Copy link

I'm experiencing the same - OnePlus 6, Android 10.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants