0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Flutter】google_maps_flutterパッケージとgoogle_mobile_adsパッケージを同時に使うとAndroidだと地図を手動で動かせない

Posted at

はじめに

タイトルにあるように、google_maps_flutterパッケージとgoogle_mobile_adsパッケージを同時に使うとAndroidだと地図を動かせなくなります。iOSは動きます。

更新履歴

2022.2.15 初回投稿

環境

  • Flutter (Channel unknown, 2.8.1, on macOS 11.6 20G165 darwin-x64, locale
    ja-JP)
  • Android toolchain - develop for Android devices (Android SDK version 31.0.0)
  • Xcode - develop for iOS and macOS (Xcode 13.2.1)
  • Chrome - develop for the web
  • Android Studio (version 2021.1)
  • VS Code (version 1.64.2)

参考にしたサイト

package

https://pub.dev/packages/google_maps_flutter
https://pub.dev/packages/google_mobile_ads

やりたいこと

GoogleMapとadMobを一緒に表示させて、地図を手動で動かしたい

手順

パッケージページにあるようにHybrid Compositionを適用するだけです。

main.dart
void main() {
  if (defaultTargetPlatform == TargetPlatform.android) {
    AndroidGoogleMapsFlutter.useAndroidViewSurface = true;
  }
  runApp(MaterialApp(home: MapsDemo()));
}

以上

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?