■前提
Flutterの開発中、AndroidEmulator上に地図を出したいと思い、
GoogleMapを表示するサンプルを試しました。
https://codelabs.developers.google.com/codelabs/google-maps-in-flutter#0
Android用のキーを取得して、AndroidManifestに設定しと進めていったところ、
無事実機ではGoogleMapが表示されることを確認。
ところがEmulator上で表示しようとしたところ、
googlemap_sample won't run without Google Play services,
which are not supported by your device.
と表示され地図が出ません。
AndroidStudioのログには
W/GooglePlayServicesUtil( 3773): Google Play Store is missing.
W/Gralloc4( 3773): allocator 3.x is not supported
というような怪しいログも出ています。
・環境
・OS
macOS Big Sur バージョン11.5.2
64bit
・実機
Pixel 55
Android 11
・エミュレータ
Pixel 5 API 30
・IDE
Android Studio Arctic Fox | 2020.3.1
■解決方法
- 64bit用のSystemImage(Google APIs Intel x86 Atom_64 System Image)をインストールする
- AVDマネージャーからAVDを編集、SystemImageを64bit向けのものに変更
この状態で起動すればGoogleMapが起動します。
VirtualDeviceを追加するときに、SystemImageを選択する箇所があるのですが、
ここのRecommended(お勧め)がx86(32bit)なんですよね。
これをそのまま選択するとハマってしまう罠となっています。
大事なのは AVDのSystemImageを64bit向けのものに変更 することです。
インストールしても設定しないと意味がない ので注意してください。