我目前正在开发一款追踪患者的应用程序。所以我使用谷歌地图,我已经从谷歌云平台获得了API密钥,并限制了Android地图SDK 的密钥
然后我更改了android manifest.xml和ios runner以及plist
当我运行应用程序时,它显示以下错误
E/flutter ( 4675): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create an already created platform view, view id: 0
E/flutter ( 4675): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:85)
E/flutter ( 4675): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:96)
E/flutter ( 4675): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
E/flutter ( 4675): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/flutter ( 4675): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/flutter ( 4675): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/flutter ( 4675): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter ( 4675): at android.os.MessageQueue.next(MessageQueue.java:326)
E/flutter ( 4675): at android.os.Looper.loop(Looper.java:160)
E/flutter ( 4675): at android.app.ActivityThread.main(ActivityThread.java:6669)
E/flutter ( 4675): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 4675): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/flutter ( 4675): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/flutter ( 4675): , null)
E/flutter ( 4675): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter ( 4675): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter ( 4675): <asynchronous suspension>
E/flutter ( 4675): #2 AndroidViewController._create (package:flutter/src/services/platform_views.dart:640:54)
E/flutter ( 4675): #3 AndroidViewController.setSize (package:flutter/src/services/platform_views.dart:557:14)
E/flutter ( 4675): #4 RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:174:29)
E/flutter ( 4675): #5 RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:155:5)
E/flutter ( 4675): #6 RenderObject.layout (package:flutter/src/rendering/object.dart:1703:9)
E/flutter ( 4675): #7 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #8 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #9 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:163:11)
E/flutter ( 4675): #10 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:477:7)
E/flutter ( 4675): #11 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:232:7)
E/flutter ( 4675): #12 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:391:14)
E/flutter ( 4675): #13 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #14 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #16 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #17 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1232:11)
E/flutter ( 4675): #18 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #19 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #21 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #23 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #25 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #27 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #28 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
E/flutter ( 4675): #29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
E/flutter ( 4675): #30 RenderObject.layout (package:flutter/src/rende
我已经为调试这个错误做了一切(尝试了10多次(。如果你能帮我解决这个问题,提前谢谢。
希望我在命令行中运行这些命令flutter clean
和flutter pub cache repair
时找到了答案,并且运行良好。除此之外,我的模拟器还没有安装谷歌播放服务。然后当我重建并运行它时。它运行良好。
但在实现下一版本的API 时,谷歌需要考虑这些例外情况