【发布时间】:2020-01-26 03:38:29
【问题描述】:
在我的用例中,我需要确保我的地图可以动态调整大小而不会崩溃,您可能会建议使用 resizeToAvoidBottomPadding,但我的问题不止于此,例如,如果我使用 facebook messanger 聊天头,我的应用程序会崩溃并打开它的键盘(这使应用程序调整大小,迫使地图调整大小,因此崩溃)
以下代码在子路由内(在包含底部标签栏的路由内,因此以下代码在该栏的按钮之一内)
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
GoogleMap(
onMapCreated: _onMapCreated,
mapType: MapType.normal,
initialCameraPosition: CameraPosition(
target: LatLng(30, 40),
zoom: 11,
),
onCameraMove: (pos) {
setState(() {
// do something
});
},
onCameraIdle: () {
setState(() {
// do something
});
},
),
TextField(),
],
);
}
编辑:这是我在控制台中收到的错误消息:
E/flutter (16068): [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 (16068): at io.flutter.plugin.platform.VirtualDisplayController.onInputConnectionLocked(VirtualDisplayController.java:166)
E/flutter (16068): at io.flutter.plugin.platform.PlatformViewsController.lockInputConnection(PlatformViewsController.java:370)
E/flutter (16068): at io.flutter.plugin.platform.PlatformViewsController.access$1000(PlatformViewsController.java:36)
E/flutter (16068): at io.flutter.plugin.platform.PlatformViewsController$1.resizePlatformView(PlatformViewsController.java:165)
E/flutter (16068): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.resize(PlatformViewsChannel.java:120)
E/flutter (16068): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:57)
E/flutter (16068): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/flutter (16068): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/flutter (16068): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/flutter (16068): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (16068): at android.os.MessageQueue.next(MessageQueue.java:323)
E/flutter (16068): at android.os.Looper.loop(Looper.java:136)
E/flutter (16068): at android.app.ActivityThread.main(ActivityThread.java:6776)
E/flutter (16068): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (16068): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
E/flutter (16068): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
E/flutter (16068): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)
E/flutter (16068):
F/flutter (16068): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).
F/libc (16068): Fatal signal 6 (SIGABRT), code -6 in tid 16068 (m.dm.dm_testing)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a7xeltexx/a7xelte:7.0/NRD90M/A710FXXU2CQG4:user/release-keys'
Revision: '3'
ABI: 'arm'
pid: 16068, tid: 16068, name: m.dm.dm_testing >>> com.dm.dm_testing <<<
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).
'
r0 00000000 r1 00003ec4 r2 00000006 r3 00000008
r4 ec60358c r5 00000006 r6 ec603534 r7 0000010c
r8 ffcc802c r9 db59415c sl 00000032 fp db594110
ip 0000000b sp ffcc7f08 lr ea8f04c7 pc ea8f2d30 cpsr 000e0010
backtrace:
#00 pc 0004ad30 /system/lib/libc.so (tgkill+12)
#01 pc 000484c3 /system/lib/libc.so (pthread_kill+34)
#02 pc 0001dd99 /system/lib/libc.so (raise+10)
#03 pc 00019521 /system/lib/libc.so (__libc_android_abort+34)
#04 pc 00017160 /system/lib/libc.so (abort+4)
#05 pc 00fa7b9f /data/app/com.dm.dm_testing-1/lib/arm/libflutter.so (offset 0xf99000)
#06 pc 00f9dde1 /data/app/com.dm.dm_testing-1/lib/arm/libflutter.so (offset 0xf99000)
#07 pc 00f9cad7 /data/app/com.dm.dm_testing-1/lib/arm/libflutter.so (offset 0xf99000)
#08 pc 00fcfb83 /data/app/com.dm.dm_testing-1/lib/arm/libflutter.so (offset 0xf99000)
#09 pc 00fa81f5 /data/app/com.dm.dm_testing-1/lib/arm/libflutter.so (offset 0xf99000)
#10 pc 00fab943 /data/app/com.dm.dm_testing-1/lib/arm/libflutter.so (offset 0xf99000)
#11 pc 00011e77 /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+614)
#12 pc 00011b83 /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+26)
#13 pc 00097325 /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEP7_JNIEnvP8_jobjecti+22)
#14 pc 7594bd55 /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x38c0000)
Lost connection to device.
感谢您的帮助。
【问题讨论】:
-
您的意思是应用程序因错误而关闭吗?提供错误堆栈跟踪
-
我编辑了添加所需信息的问题@Pavel
标签: google-maps flutter dart flutter-layout