Open leonardopaim opened 5 years ago
I was able to work around the issue by changing the widget that surrounds PDFViewer ().
it was like this:
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
path != null
? Flexible(
fit: FlexFit.loose,
flex: 1,
child: Container(
child: PdfViewer(
filePath: path,
),
),
)
: Flexible(
fit: FlexFit.loose,
flex: 1,
child: Container(
child: Text("O PDF não está carregado"),
),
),
listaDeOpcoesMinimalista(),
],
),
),
);
}
I didn't understand how the previous mode hampers screen loading. If you have any advice that better my implementation I would be grateful.
@leonardopaim Hey, I saw that your problem is the need for defining a valid path to works, I will try to validate the path before load to fix this.
@lubritto Thank you, I will be waiting for the improvement.
Strange behavior is also happening that I couldn't understand how to solve and I don't know if it's related to the initial problem.
After the file is rendered on screen, if I save the project, causing hot reload to run, the app is giving fatal error.
DEBUG CONSOLE
Launching lib\main.dart on Mi A1 in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
D/com.shockwave.pdfium.PdfiumCore( 7527): Starting PdfiumAndroid 1.9.0
W/us.sommusvenda( 7527): Accessing hidden field Ljava/io/FileDescriptor;->descriptor:I (light greylist, reflection)
D/jniPdfium( 7527): Init FPDF library
E/flutter ( 7527): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.AbstractMethodError: abstract method "void io.flutter.plugin.platform.PlatformView.onInputConnectionLocked()"
E/flutter ( 7527): at io.flutter.plugin.platform.VirtualDisplayController.onInputConnectionLocked(VirtualDisplayController.java:166)
E/flutter ( 7527): at io.flutter.plugin.platform.PlatformViewsController.lockInputConnection(PlatformViewsController.java:370)
E/flutter ( 7527): at io.flutter.plugin.platform.PlatformViewsController.access$1000(PlatformViewsController.java:36)
E/flutter ( 7527): at io.flutter.plugin.platform.PlatformViewsController$1.resizePlatformView(PlatformViewsController.java:165)
E/flutter ( 7527): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.resize(PlatformViewsChannel.java:120)
E/flutter ( 7527): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:57)
E/flutter ( 7527): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/flutter ( 7527): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/flutter ( 7527): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/flutter ( 7527): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 7527): at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter ( 7527): at android.os.Looper.loop(Looper.java:160)
E/flutter ( 7527): at android.app.ActivityThread.main(ActivityThread.java:6762)
E/flutter ( 7527): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7527): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/flutter ( 7527): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter ( 7527):
F/flutter ( 7527): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
F/libc ( 7527): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 7527 (us.sommusvendas), pid 7527 (us.sommusvendas)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'xiaomi/tissot/tissot_sprout:9/PKQ1.180917.001/V10.0.13.0.PDHMIXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 7527, tid: 7527, name: us.sommusvendas >>> com.sommus.sommusvendas <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
'
x0 0000000000000000 x1 0000000000001d67 x2 0000000000000006 x3 0000000000000008
x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 0000000000000080
x8 0000000000000083 x9 225b81b0efc68628 x10 0000000000000000 x11 fffffffc7ffffbdf
x12 0000000000000001 x13 0000000000000002 x14 ffffffffffffffff x15 0000000000000000
x16 0000007e0bf512b0 x17 0000007e0be729d8 x18 0000000000000010 x19 0000000000001d67
x20 0000000000001d67 x21 0000007ffe0fa1f8 x22 0000007d6567c070 x23 0000007d6f1eaf58
x24 000000000000002b x25 0000007ffe0fa4a0 x26 0000007e1137c5e0 x27 000000000000002b
x28 0000000000000001 x29 0000007ffe0fa1e0
sp 0000007ffe0fa1a0 lr 0000007e0be6400c pc 0000007e0be64034
Reloaded 12 of 567 libraries in 1.826ms.
backtrace:
#00 pc 0000000000022034 /system/lib64/libc.so (abort+116)
#01 pc 00000000011d4c3c /data/app/com.sommus.sommusvendas-x4N4MOuqYqbsukwnexkv5w==/lib/arm64/libflutter.so (offset 0x11c0000)
#02 pc 00000000011c6f9c /data/app/com.sommus.sommusvendas-x4N4MOuqYqbsukwnexkv5w==/lib/arm64/libflutter.so (offset 0x11c0000)
#03 pc 00000000011c549c /data/app/com.sommus.sommusvendas-x4N4MOuqYqbsukwnexkv5w==/lib/arm64/libflutter.so (offset 0x11c0000)
#04 pc 000000000120d9ac /data/app/com.sommus.sommusvendas-x4N4MOuqYqbsukwnexkv5w==/lib/arm64/libflutter.so (offset 0x11c0000)
#05 pc 00000000011d55a8 /data/app/com.sommus.sommusvendas-x4N4MOuqYqbsukwnexkv5w==/lib/arm64/libflutter.so (offset 0x11c0000)
#06 pc 00000000011da7c8 /data/app/com.sommus.sommusvendas-x4N4MOuqYqbsukwnexkv5w==/lib/arm64/libflutter.so (offset 0x11c0000)
#07 pc 0000000000014ff8 /system/lib64/libutils.so (android::Looper::pollInner(int)+836)
#08 pc 0000000000014c18 /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+60)
#09 pc 0000000000126964 /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44)
#10 pc 0000000000c86a8c /system/framework/arm64/boot-framework.oat (offset 0x915000) (android.media.MediaExtractor.seekTo [DEDUPED]+140)
#11 pc 0000000000002a5c /dev/ashmem/dalvik-jit-code-cache (deleted) (android.os.MessageQueue.next+204)
#12 pc 0000000000554f88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#13 pc 00000000000cf6c8 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#14 pc 000000000027f22c /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#15 pc 0000000000279240 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
#16 pc 00000000005246f4 /system/lib64/libart.so (MterpInvokeVirtual+588)
#17 pc 0000000000547694 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#18 pc 0000000000b22e4c /system/framework/boot-framework.vdex (android.os.Looper.loop+128)
#19 pc 0000000000252f44 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.1997279576+488)
#20 pc 0000000000258a38 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#21 pc 0000000000279224 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+940)
#22 pc 0000000000525bf8 /system/lib64/libart.so (MterpInvokeStatic+204)
#23 pc 0000000000547814 /system/lib64/libart.so (ExecuteMterpImpl+14612)
#24 pc 00000000003a2d96 /system/framework/boot-framework.vdex (android.app.ActivityThread.main+214)
#25 pc 0000000000252f44 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.1997279576+488)
#26 pc 0000000000514fa8 /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
#27 pc 000000000055e0fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#28 pc 000000000055524c /system/lib64/libart.so (art_quick_invoke_static_stub+604)
#29 pc 00000000000cf6e8 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
#30 pc 000000000045c85c /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#31 pc 000000000045e2b0 /system/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1440)
#32 pc 00000000003ee18c /system/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52)
#33 pc 000000000078eed4 /system/framework/arm64/boot-core-oj.oat (offset 0x2dc000) (java.lang.Class.getDeclaredMethodInternal [DEDUPED]+180)
#34 pc 0000000000554f88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#35 pc 00000000000cf6c8 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#36 pc 000000000027f22c /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#37 pc 0000000000279240 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+968)
#38 pc 00000000005246f4 /system/lib64/libart.so (MterpInvokeVirtual+588)
#39 pc 0000000000547694 /system/lib64/libart.so (ExecuteMterpImpl+14228)
#40 pc 0000000000dca492 /system/framework/boot-framework.vdex (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+22)
#41 pc 0000000000252f44 /system/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEb.llvm.1997279576+488)
#42 pc 0000000000514fa8 /system/lib64/libart.so (artQuickToInterpreterBridge+1020)
#43 pc 000000000055e0fc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#44 pc 0000000001a4f2a0 /system/framework/arm64/boot-framework.oat (offset 0x915000) (com.android.internal.os.ZygoteInit.main+3088)
#45 pc 000000000055524c /system/lib64/libart.so (art_quick_invoke_static_stub+604)
#46 pc 00000000000cf6e8 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+232)
#47 pc 000000000045c85c /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#48 pc 000000000045c4bc /system/lib64/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+424)
#49 pc 0000000000361ac8 /system/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+652)
#50 pc 00000000000b1fa0 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116)
#51 pc 00000000000b49c4 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+752)
#52 pc 000000000000251c /system/bin/app_process64 (main+2000)
#53 pc 00000000000ca47c /system/lib64/libc.so (__libc_init+88)
Lost connection to device.
Exited (sigterm)
This issue is affecting a process I have on a screen that comes after viewing the PDF. I want to email the file and ask on another screen for the user to type. As soon as I click on TextFormField, the above behavior happens.
If you know a way this problem does not occur please let me know.
This will help https://www.youtube.com/watch?v=gAUVz0U7eyA
I am Brazilian and I used google translator translation for this request:
I am trying to render a PDF on my App Flutter screen and at the moment the
getApplicationDocumentsDirectory()
method is called on the first line ofloadPdf()
the error described below is being returned.In some attempts to get around the problem I saw that this method only returns the error when I have lib
pdf_viewer_plugin
imported into my project. If this lib is not imported thegetApplicationDocumentsDirectory()
method that is part ofpath_provider
works normally.(Device model used in development: Xiaomi Mi A1)
CODE:
ERROR: