我在应用程序中使用了GoogleMaps小部件,注意到每当我最小化应用程序并重新打开它时,它就会崩溃。因此,我在终端中进行了详细的运行,并在应用程序退出前获得了以下日志。
颤振运行-v
[ ] W/le.great_place(16700): Accessing hidden method
Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
[+18210 ms] W/le.great_place(16700): Accessing hidden method
Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist,
linking, allowed)
[ ] W/le.great_place(16700): Accessing hidden method
Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist,
linking, allowed)
[ ] W/le.great_place(16700): Accessing hidden method
Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
[+2733 ms] D/EGL_emulation(16700): eglMakeCurrent: 0xdefcff80: ver 1 0 (tinfo
0xbf735300)
[ +30 ms] D/EGL_emulation(16700): eglMakeCurrent: 0xd39cd5c0: ver 3 0 (tinfo
0xd3a25b50)
[ ] E/flutter (16700): [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(72)]
Failed to setup Skia Gr context.
[ +19 ms] D/EGL_emulation(16700): eglMakeCurrent: 0xdf07cf40: ver 3 0 (tinfo
0xd3a25980)
[ +60 ms] F/libc (16700): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR),
fault addr 0x8 in tid 16728 (1.raster), pid 16700 (le.great_places)
[ +83 ms] *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
[ ] Build fingerprint:
'google/sdk_gphone_x86/generic_x86:10/QSR1.190920.001/5891938:user/release-keys'
[ ] Revision: '0'
[ ] ABI: 'x86'
[ ] Timestamp: 2020-11-16 22:39:13+0300
[ ] pid: 16700, tid: 16728, name: 1.raster >>> com.example.great_places
<<<
[ ] uid: 10135
[ ] signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x8
[ ] Cause: null pointer dereference
[ ] eax 00000000 ebx bee86920 ecx fffffff9 edx 00000000
[ ] edi 00000004 esi 00000000
[ ] ebp bce01698 esp bce01698 eip be7d4de5
[ +57 ms] backtrace:
[ ] #00 pc 013cade5
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #01 pc 013e3673
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #02 pc 0146b58e
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #03 pc 0163ead3
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #04 pc 0163e9a5
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #05 pc 0163ee93
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #06 pc 0163ec7f
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #07 pc 011f43b5
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #08 pc 011f500a
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #09 pc 011f5e32
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #10 pc 011a2f9b
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #11 pc 011f48e4
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #12 pc 011f464c
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ ] #13 pc 0120276f
/data/app/com.example.great_places-8aRXGQi2nu_naeDUo8qoOQ==/lib/x86/libflutter.s
o (BuildId: 41b41257bd3fecb2110b68babe76fd09ee5a57bd)
[ +528 ms] Service protocol connection closed.
[ +1 ms] Lost connection to device.
[ +4 ms] executing: /Users/lordvidex/Library/Android/sdk/platform-tools/adb -s
emulator-5554 forward --list
[ +19 ms] Exit code 0 from:
/Users/lordvidex/Library/Android/sdk/platform-tools/adb -s emulator-5554 forward
--list
[ ] emulator-5554 tcp:58681 tcp:45635
[ +2 ms] executing: /Users/lordvidex/Library/Android/sdk/platform-tools/adb -s
emulator-5554 forward --remove tcp:58681
[ +20 ms] DevFS: Deleting filesystem on the device
(file:///data/user/0/com.example.great_places/code_cache/greatplacesMECEQC/great
places/)
[ +258 ms] Ignored error while cleaning up DevFS: TimeoutException after
0:00:00.250000: Future not completed
[ +1 ms] executing: /Users/lordvidex/Library/Android/sdk/platform-tools/adb -s
emulator-5554 forward --list
[ +10 ms] Exit code 0 from:
/Users/lordvidex/Library/Android/sdk/platform-tools/adb -s emulator-5554 forward
--list
[ +2 ms] "flutter run" took 41,422ms.
[ +214 ms] ensureAnalyticsSent: 209ms
[ +1 ms] Running shutdown hooks
[ ] Shutdown hook priority 4
[ +1 ms] Shutdown hooks complete
[ ] exiting with code 0
现在,我在iOS模拟器和真正的Android设备上运行了完全相同的代码,没有出现崩溃。造成这种情况的原因是什么?发布应用程序后,我如何确保它不会在真实设备上崩溃
代码到MapScreen可以在这里查看
颤振-版本
Flutter 1.22.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1aafb3a8b9 (3 days ago) • 2020-11-13 09:59:28 -0800
Engine • revision 2c956a31c0
Tools • Dart 2.10.4
我建议您使用真实的设备进行尝试。
你可以将你的真实设备连接到你的计算机上,并使用flutter run -d {device Name/Id}
进行构建
设备名称/id可以通过命令flutter devices
找到
模拟器并不完美,一些功能可能会导致崩溃(例如,在iOS设备上访问图库会导致Flutter崩溃(。