谷歌地图试图创建未注册类型的平台视图

google maps Trying to create a platform view of unregistered type(谷歌地图试图创建未注册类型的平台视图)

本文介绍了谷歌地图试图创建未注册类型的平台视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有应用程序我正在处理它在我升级1.12之前的Android项目之前工作正常,而不是它给我一个错误google maps Trying to create a platform view of unregistered type

和地图在iOS中运行良好,使用的Google API密钥与我在Android中使用的相同

我已执行了多个flutter clean并卸载了应用程序并使用了不同的仿真器,错误相同

androidManifest.xml

  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="come.example.appid">

    <uses-permission android:name="android.permission.INTERNET"/>
    <!-- Speech To Text configration -->
    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <!-- Geolocator Configration Start -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <!-- Geolocator Configration end -->
    <!-- Local Notification -->
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <!-- Local Notification -->

    <application
        tools:replace="android:label"
        android:label="appname"
        android:icon="@mipmap/launcher_icon">

        <!-- Google Maps -->
        <meta-data android:name="com.google.android.geo.API_KEY"
             android:value="APIKeyyyyyyyyyyyy-xxxxxxxx"/>

        <!-- Google Maps -->
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_channel_id"
            android:value="@string/default_notification_channel_id"/>

        <!-- Facebook Configration Start -->
        <!-- <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id"/> -->


        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges=
                    "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name" />

        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true">

            <!-- FCM Configration start -->
            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <!-- FCM Configration end -->

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
        <!-- Facebook Configration end -->

        <!-- Local Notification -->
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>


        <activity
            android:name="io.flutter.embedding.android.FlutterActivity"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">

            <!-- Specify that the launch screen should continue being displayed -->
            <!-- until Flutter renders its first frame. -->
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background" />

            <!-- Theme to apply as soon as Flutter begins rendering frames -->
            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme"
                />

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>


        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />

    </application>
</manifest>

错误

E/Ffltter(8262):[错误:Ffltter/lib/ui/ui_dart_state.cc(157)] 未处理的异常:平台异常(Error, 异常:尝试创建的平台视图 未注册类型:plugins.fltter.io/GOOGLE_MAPPS E/Ffltter(8262): 在… Io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:91) E/扑翼(8262):在 Io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:96) E/扑翼(8262):在 Io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60) E/扑翼(8262):在 Io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231) 电子/颤动(8262):

推荐答案

我在安卓系统上也遇到了同样的错误,但我的代码在执行以下步骤后可以正常工作:

  1. 清除应用数据(&A)卸载当前应用。
  2. 干净运行扑翼构建(&A)。
  3. 再次运行您的应用程序

这篇关于谷歌地图试图创建未注册类型的平台视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:谷歌地图试图创建未注册类型的平台视图

基础教程推荐