4
votes

google maps Tentative de création d'une vue de plate-forme de type non enregistré

J'ai une application sur laquelle je travaille, cela fonctionne aussi bien avant de mettre à niveau des projets Android antérieurs à la version 1.12, non cela me donne une erreur google maps Trying to create a platform view of unregistered type

et la carte fonctionne bien dans IOS avec la même clé api google que j'ai utilisée dans Android

J'ai flutter clean plus d'un et désinstallé l'application et utilisé un émulateur différent, l'erreur est la même

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>

l'erreur est

E / flutter (8262): [ERREUR: flutter / lib / ui / ui_dart_state.cc (157)] Exception non gérée: PlatformException (erreur, java.lang.IllegalStateException: tentative de création d'une vue de plate-forme de type non enregistré: plugins.flutter. io / google_maps E / flutter (8262): à io.flutter.plugin.platform.PlatformViewsController $ 1.createPlatformView (PlatformViewsController.java:91) E / flutter (8262): à io.flutter.embedding.engine.systemchannels.PlatformViews .create (PlatformViewsChannel.java:96) E / flutter (8262): à io.flutter.embedding.engine.systemchannels.PlatformViewsChannel $ 1.onMethodCall (PlatformViewsChannel.java:60) E / flutter (8262): à io.flutter. plugin.common.MethodChannel $ IncomingMethodCallHandler.onMessage (MethodChannel.java:231) E / flutter (8262):


1 commentaires

Je fais face au même problème, je viens du code. ajoutez votre code le fichier a un widget GoogleMap. Peut-être que je peux vous aider


3 Réponses :


7
votes

J'ai également la même erreur pour Android mais mon code fonctionne après avoir suivi ces étapes:

  1. Nettoyer les données de l'application et désinstaller l'application actuelle.
  2. Exécutez flutter clean & flutter build.
  3. Exécutez à nouveau votre application

0 commentaires

4
votes

Votre minSdkVersion doit être supérieur à 20

1. flutter clean
2. flutter run

J'ai résolu mon problème


0 commentaires

0
votes

Remplacez dans MainActivity.kt la prochaine importation:
import io.flutter.app.FlutterActivity
pour:
import io.flutter.embedding.android.FlutterActivity

Cela résout le problème!


0 commentaires