Closed7

Flutter環境構築 Mac M1 (Apple Silicon) でAndroid Emulatorを試す

hndrhndr

Android StudioからM1 Macで動くARM版のAndroid Emulator のイメージがAVD Managerから落とせるようになってるので試した。
https://github.com/google/android-emulator-m1-preview

翻訳

M1ベースのエミュレーターのダウンロードのサポートがSDK Managerに追加されたため、
Githubリリースページに移動してスタンドアロンの.appをダウンロードする必要がなくなりました。
AVD Managerで、[Other Images]タブに移動します。デフォルトでは、ARM64 imageは表示されません。
hndrhndr

AVD ManagerからCreate Virtual Device で任意のデバイスを選択

Other Images タブ > arm64-v8a のイメージを選択


Trouble shoot

翻訳

お使いのコンピュータは、ハードウェアアクセラレーションによる仮想化をサポートしていません。
以下の方法が考えられます。
1) 物理デバイスを使ってテストする 
2) VT-xおよびNXをサポートするIntelプロセッサを搭載したWindows/OSXコンピュータで開発する。
3) VT-xまたはSVMをサポートするLinuxコンピュータで開発する。
4) ARMシステムイメージをベースにしたAndroid仮想デバイスを使用
(ハードウェアアクセラレーションによる仮想化に比べて10倍遅くなります)。

AVD Manager

errorで起動しない

SDK Manager


SDKも色々入れてみたが起動せず

hndrhndr

いろいろ試してみたものの起動せず困っていたが、Issueに起動できそうな方法が投稿されたので試した。
https://github.com/google/android-emulator-m1-preview/issues/34

./Library/Android/sdk/emulator/darwin-aarch64-replace.sh
またはm1-preview内
/Applications/Android\ Emulator.app/Contents/MacOS/emulator/darwin-aarch64-replace.sh
にある
darwin-aarch64-replace.sh をデスクトップにコピーしてきて実行

% /Users/hndr/Desktop/darwin-aarch64-replace.sh 
curl -L https://github.com/google/android-emulator-m1-preview/releases/download/0.2/emulator-darwin-aarch64-0.2-engine-only.zip -o emulator-darwin-aarch64-0.2.zip
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
100   651  100   651    0     0   1722      0 --:--:-- --:--:-- --:--:--  1722
100 91.8M  100 91.8M    0     0  9918k      0  0:00:09  0:00:09 --:--:-- 10.5M
unzip emulator-darwin-aarch64-0.2.zip
Archive:  emulator-darwin-aarch64-0.2.zip
  creating: emulator-darwin-aarch64-0.2/
 inflating: emulator-darwin-aarch64-0.2/NOTICE.csv  
 inflating: emulator-darwin-aarch64-0.2/qsn  
 inflating: emulator-darwin-aarch64-0.2/qemu-img  
  creating: emulator-darwin-aarch64-0.2/lib64/
 inflating: emulator-darwin-aarch64-0.2/lib64/libemugl_common.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/qt/
  creating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/
  creating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/platforms/
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/platforms/libqcocoa.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/styles/
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/styles/libqmacstyle.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/bearer/
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/bearer/libqgenericbearer.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/iconengines/
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/iconengines/libqsvgicon.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqgif.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqwbmp.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqwebp.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqico.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqmacheif.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqjpeg.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqtiff.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqsvg.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqicns.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqtga.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/plugins/imageformats/libqmacjp2.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/qt/lib/
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5CoreAndroidEmu.5.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5PrintSupportAndroidEmu.5.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5SvgAndroidEmu.5.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5WidgetsAndroidEmu.5.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5DBusAndroidEmu.5.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5GuiAndroidEmu.5.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/qt/lib/libQt5NetworkAndroidEmu.5.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/gles_swiftshader/
 inflating: emulator-darwin-aarch64-0.2/lib64/gles_swiftshader/libEGL.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/gles_swiftshader/libGLES_CM.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/gles_swiftshader/libGLESv2.dylib  
  creating: emulator-darwin-aarch64-0.2/lib64/vulkan/
 inflating: emulator-darwin-aarch64-0.2/lib64/vulkan/libMoltenVK.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/vulkan/MoltenVK_icd.json  
 inflating: emulator-darwin-aarch64-0.2/lib64/libshadertranslator.dylib  
 inflating: emulator-darwin-aarch64-0.2/lib64/libOpenglRender.dylib  
 inflating: emulator-darwin-aarch64-0.2/LICENSE  
 inflating: emulator-darwin-aarch64-0.2/darwin-aarch64-replace.sh  
  creating: emulator-darwin-aarch64-0.2/resources/
  creating: emulator-darwin-aarch64-0.2/resources/macroPreviews/
 inflating: emulator-darwin-aarch64-0.2/resources/macroPreviews/Reset_position.mp4  
 inflating: emulator-darwin-aarch64-0.2/resources/macroPreviews/Walk_to_image_room.mp4  
 inflating: emulator-darwin-aarch64-0.2/resources/macroPreviews/Track_vertical_plane.mp4  
 inflating: emulator-darwin-aarch64-0.2/resources/macroPreviews/Track_horizontal_plane.mp4  
 inflating: emulator-darwin-aarch64-0.2/resources/Toren1BD_Decor.png  
 inflating: emulator-darwin-aarch64-0.2/resources/poster.png  
 inflating: emulator-darwin-aarch64-0.2/resources/Toren1BD.mtl  
 inflating: emulator-darwin-aarch64-0.2/resources/Toren1BD_Main.png  
 inflating: emulator-darwin-aarch64-0.2/resources/Toren1BD.posters  
 inflating: emulator-darwin-aarch64-0.2/resources/Toren1BD.obj  
  creating: emulator-darwin-aarch64-0.2/resources/macros/
 inflating: emulator-darwin-aarch64-0.2/resources/macros/Track_vertical_plane  
 inflating: emulator-darwin-aarch64-0.2/resources/macros/Reset_position  
 inflating: emulator-darwin-aarch64-0.2/resources/macros/Track_horizontal_plane  
 inflating: emulator-darwin-aarch64-0.2/resources/macros/Walk_to_image_room  
  creating: emulator-darwin-aarch64-0.2/bin64/
 inflating: emulator-darwin-aarch64-0.2/bin64/fsck.ext4  
 inflating: emulator-darwin-aarch64-0.2/bin64/mkfs.ext4  
 inflating: emulator-darwin-aarch64-0.2/bin64/tune2fs  
 inflating: emulator-darwin-aarch64-0.2/bin64/resize2fs  
 inflating: emulator-darwin-aarch64-0.2/bin64/e2fsck  
 inflating: emulator-darwin-aarch64-0.2/source.properties  
 inflating: emulator-darwin-aarch64-0.2/emulator-check  
 inflating: emulator-darwin-aarch64-0.2/NOTICE.txt  
 inflating: emulator-darwin-aarch64-0.2/android-info.txt  
 inflating: emulator-darwin-aarch64-0.2/perfetto-protozero-protoc-plugin  
  creating: emulator-darwin-aarch64-0.2/qemu/
  creating: emulator-darwin-aarch64-0.2/qemu/darwin-aarch64/
 inflating: emulator-darwin-aarch64-0.2/qemu/darwin-aarch64/qemu-system-aarch64  
 inflating: emulator-darwin-aarch64-0.2/qemu/darwin-aarch64/qemu-system-aarch64-headless  
 inflating: emulator-darwin-aarch64-0.2/mksdcard  
  creating: emulator-darwin-aarch64-0.2/lib/
 inflating: emulator-darwin-aarch64-0.2/lib/waterfall.proto  
 inflating: emulator-darwin-aarch64-0.2/lib/emulator_controller.proto  
 inflating: emulator-darwin-aarch64-0.2/lib/advancedFeaturesCanary.ini  
 inflating: emulator-darwin-aarch64-0.2/lib/hardware-properties.ini  
 inflating: emulator-darwin-aarch64-0.2/lib/advancedFeatures.ini  
 inflating: emulator-darwin-aarch64-0.2/lib/hostapd.conf  
  creating: emulator-darwin-aarch64-0.2/lib/pc-bios/
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/efi-e1000.rom  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/kvmvapic.bin  
  creating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/sl  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/pl  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/modifiers  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/sv  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/da  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/no  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/Makefile  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/ja  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/lv  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/it  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/is  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/cz  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/ru  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/en-gb  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/bepo  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/common  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/pt  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/fr-ch  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/fr-ca  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/mk  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/ar  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/hr  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/pt-br  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/hu  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/nl  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/de  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/fi  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/fr  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/es  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/et  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/lt  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/fo  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/en-us  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/de-ch  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/th  
extracting: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/nl-be  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/fr-be  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/keymaps/tr  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/multiboot.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/vgabios-stdvga.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/bios.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/vgabios-virtio.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/bios-256k.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/linuxboot_dma.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/linuxboot.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/efi-virtio.rom  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/efi-e1000e.rom  
 inflating: emulator-darwin-aarch64-0.2/lib/pc-bios/vgabios-cirrus.bin  
 inflating: emulator-darwin-aarch64-0.2/lib/snapshot_service.proto  
 inflating: emulator-darwin-aarch64-0.2/lib/emu-original-feature-flags.protobuf  
 inflating: emulator-darwin-aarch64-0.2/lib/snapshot.proto  
 inflating: emulator-darwin-aarch64-0.2/lib/ca-bundle.pem  
 inflating: emulator-darwin-aarch64-0.2/lib/ui_controller_service.proto  
 inflating: emulator-darwin-aarch64-0.2/emulator  
rm: ./qsn: No such file or directory

ダウンロードされてきた emulator-darwin-aarch64-0.2.zip の中身を
/Library/Android/sdk/emulator/ に上書きしたら起動した。
まだ不安定な感じだけど音も鳴る。

hndrhndr

1日使ってみてFirebase のAuthやfirestoreも今のところ普通に動いてるので、それなりに実用レベルだと思う。
ネットに情報殆どないのは問題ないからなのか、みんな知らないからなのかわからない。

hndrhndr

あとwebview関連でchromeが立ち上がらず落ちる

このスクラップは2021/05/22にクローズされました