Mac M1 Android Emulator

M1 Macbookを使っている方はFlutterの環境構築でAndroidエミュレータが使えなくて焦ったと思います。
私もまだまだ初心者なので色々と拙いですが、よろしくおねがいします。

M1macじゃなければ動くように設定できている前提で進めます。

The emulator works great, its super fast, so much more than what I have used in my windows machine. And regarding the full screen halt its due to macos big sur. Had that issue on my old mac. Run this command on the terminal and it wont happen again defaults write com.google.android.studio AppleWindowTabbingMode manual. A solution I did find out about was to install android-emulator-m1-preview from google, launch that instead of launching the emulator from inside Android Studio. Its almost annoying how simple of an issue it turned out to be to fix. To run an Android Emulator on an M1 Mac. Complete the following steps: Make sure you have the Android S preview installed using the SDK manager. Select the show package details checkbox and select Google APIs ARM 64 v8 system image and click OK. Create a new device in the AVD Manager and select the other images tab.

(面倒だったら挫折する前にiOSで開発を進めちゃうのでも全然良いと思います。)

M1 Macbookではエミュレータが使えないということで、2020年の12月頃にGoogleがAndroidのデモ操作をできるパッケージを提供しました。

そのパッケージを使うことでAndroid Emulatorというアプリをダウンロードして起動してデモ操作ができるようになりました。

Emulatore Android Mac M1

そして2021年3月頃に、そのパッケージは必要なくなりました。Android Studioでエミュレータが起動できるようになったからです。

その方法を解説します。

AndroidMac m1 android simulator

まず画面右上の辺りからAVD Managerを開き、 Create Virtual Device...を開きます。

適当に選択します。 

次にOther Imagesの欄に移動してください。
私は既にダウンロード済みになっていますが、 API Level30辺りを適当に選択して、ください。
大事なのはABIがarm~となっているやつです。このarmがついているのを選択するとM1でも利用できるようになるみたいです。(まだまだ作業は続きます)
Nextを押してダウンロードを進めていってください。

ダウンロードが完了して開こうとすると、The emulator process for AVD was killed と出てエミュレータは開けないでしょう。

ここで一度API Levelがダウンロードしたエミュレータと同じものを利用できるようになっているかチェックしてみてください。

次に、

./Library/Android/sdk/emulator/darwin-aarch64-replace.sh

のdarwin-aarch64-replace.shを起動してください。

起動の仕方はTerminalでemulatorディレクトリまで移動した後に、

これで

emulator-darwin-aarch64-0.2.zip

がダウンロードされているはずです。このファイルをクリックすると emulator-darwin-aarch64-0.2
というファイルが生成されます。

emulator-darwin-aarch64-0.2を開いて中身を全てemulatorファイルに移してください。

Mac m1 android emulator no internet

そしてAVD Managerを開くと

Mac M1 Android Emulator Windows 10

<参考記事>
https://github.com/google/android-emulator-m1-preview/issues/34