0
votes

i use google_maps_flutter 0.5.21+6 plugin https://pub.dev/packages/google_maps_flutter

i did everything in the document and when i run the application there's no error but blank page without map. added API key in the application manifest

 <meta-data android:name="com.google.android.geo.API_KEY"
                   android:value="*************"/>

my API settings

enter image description here

main.dart

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Completer<GoogleMapController> _controller = Completer();
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Column(
        children: <Widget>[
          Container(
            height: 150,
            width: 150,
                      child: GoogleMap(
              mapType: MapType.normal,
              initialCameraPosition:
                  CameraPosition(target: LatLng(40.712776, -74.005974), zoom: 12),
              onMapCreated: (GoogleMapController controller) {
                _controller.complete(controller);
              },
            ),
          )
        ],
      ),
    );
  }
}

debug

E/MethodChannel#flutter/platform_views( 6425): at com.google.maps.api.android.lib6.drd.p.b(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):22) E/MethodChannel#flutter/platform_views( 6425): at com.google.maps.api.android.lib6.auth.d.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):82) E/MethodChannel#flutter/platform_views( 6425): at com.google.maps.api.android.lib6.impl.d.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):41) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.maps.internal.CreatorImpl.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):54) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.maps.internal.CreatorImpl.newMapViewDelegate(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):32) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.maps.internal.h.a(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):62) E/MethodChannel#flutter/platform_views( 6425): at cv.onTransact(:com.google.android.gms.dynamite_mapsdynamite@[email protected] (100700-269183835):4) E/MethodChannel#flutter/platform_views( 6425): at android.os.Binder.transact(Binder.java:667) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.internal.maps.zza.zza(Unknown Source:10) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.maps.internal.zzf.zza(Unknown Source:19) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.maps.MapView$zzb.createDelegate(Unknown Source:13) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.dynamic.DeferredLifecycleHelper.zaa(Unknown Source:18) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.dynamic.DeferredLifecycleHelper.onCreate(Unknown Source:22) E/MethodChannel#flutter/platform_views( 6425): at com.google.android.gms.maps.MapView.onCreate(Unknown Source:26) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugins.googlemaps.GoogleMapController.init(GoogleMapController.java:136) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugins.googlemaps.GoogleMapBuilder.build(GoogleMapBuilder.java:32) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugins.googlemaps.GoogleMapFactory.create(GoogleMapFactory.java:51) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:158) E/MethodChannel#flutter/platform_views( 6425): at android.app.Dialog.dispatchOnCreate(Dialog.java:407) E/MethodChannel#flutter/platform_views( 6425): at android.app.Dialog.show(Dialog.java:302) E/MethodChannel#flutter/platform_views( 6425): at android.app.Presentation.show(Presentation.java:249) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugin.platform.VirtualDisplayController.(VirtualDisplayController.java:92) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:52) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugin.platform.PlatformViewsController$1.createPlatformView(PlatformViewsController.java:97) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:87) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:51) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96) E/MethodChannel#flutter/platform_views( 6425): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656) E/MethodChannel#flutter/platform_views( 6425): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#flutter/platform_views( 6425): at android.os.MessageQueue.next(MessageQueue.java:326) E/MethodChannel#flutter/platform_views( 6425): at android.os.Looper.loop(Looper.java:160) E/MethodChannel#flutter/platform_views( 6425): at android.app.ActivityThread.main(ActivityThread.java:6680) E/MethodChannel#flutter/platform_views( 6425): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#flutter/platform_views( 6425): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/MethodChannel#flutter/platform_views( 6425): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

update : i changed the API key place in manifest and it works but still blank with google logo enter image description here

1

1 Answers

0
votes

solved i added my project to Application restrictions and worked enter image description here

it supposed to work without having to that but i don't know why didn't work.