171

I started Android Studio 4.1 in macOS Big Sure 11.0.1 with new ARM cpu M1

After installing Rosetta: Yes, it builds !

But the Emulator has problems, it shows me CPU does not support VT-x

Even ARM images have this issue enter image description here

I used the most recent, a very old api25 (Google has to do here something) but it's increadible slow

How to make the Emulator work and fast ?

hannes ach
  • 16,247
  • 7
  • 61
  • 84
  • 2
    Right now you won't be able to run the emulator since it uses Intel HAXM, which in turn uses Intel VT-x and Rosetta doesn't support virtualization. The fix has to come from the Android team to make it work with the M1 way of virtualization. :( – Siddharth Kamaria Nov 19 '20 at 13:15
  • Exactly, I opened a Google ticket as well https://issuetracker.google.com/issues/173624439 Ok, I understand for x86 but why it's for ARM images as well ? – hannes ach Nov 19 '20 at 13:39
  • 1
    Irrespective of Intel or ARM image, you need virtualization as it acts as a guest OS atop the host OS. The same reason why you can't run an x86 Linux image on a running x86 macOS or x86 Windows without using Parallels or VMWare! – Siddharth Kamaria Nov 19 '20 at 14:08
  • A good read on emulation vs virtualization -- https://www.cloudsavvyit.com/7952/whats-the-difference-between-virtualization-and-emulation-why-it-matters/ – Siddharth Kamaria Nov 19 '20 at 14:18
  • https://developer.android.com/studio/releases/emulator?authuser=1#emulator_for_arm64_hosts here is a sentence "Support for Apple Silicon is in progress." – hannes ach Dec 06 '20 at 16:26
  • I hope they release soon as I ended up buying the M1 Mac. :) – Siddharth Kamaria Dec 06 '20 at 16:41
  • Has anyone had success with emulators running API < 29? I'm able to create them but the emulator screen is entirely black. – masterwok Nov 04 '21 at 21:05
  • 2
    @masterwok api25 is complete black on my machine too – hannes ach Nov 05 '21 at 06:14
  • 2
    @masterwok API 24 is all black for me too – WatashiJ Jan 28 '22 at 19:37

20 Answers20

291

Good news !

Edit on 28th of July 2021

Apple Silicon M1 Support

Now, there is an arm64 release version available for Android Studio Arctic Fox (2020.3.1) You can download it from here https://developer.android.com/studio#downloads

Easy fix to use right architecture

Tools -> SDK Manager -> SDK Tools (tab) -> Deselect 'Android Emulator' -> OK

Now, when you try to run your app, or launch device from AVD Manager, it will give the 'Install Emulator' error -> Click Ok. This will automatically download the correct version.

Use an arm64-v8a image !

  • Tools -> SDK Manager
  • Install Android 11 (R) or 12.0 (S) and click Apply
  • Tools -> AVD Manager -> click Create Virtual Device
  • Choose any device that has the Google Play Store icon and click Next
  • Choose an arm64-v8a on "Other Images" tab

Android studio

hannes ach
  • 16,247
  • 7
  • 61
  • 84
  • Thanks for the Answer. I have ordered an MBA and just wondering if it will be taxing enough to heat it up and throttle it.. – Alexander Suraphel Dec 29 '20 at 19:45
  • I found a way to hear the ventilator for a long time with 100% CPU usage: just build one of this pull request local https://github.com/hannesa2/mediapipe/pull/7 With a normal Android studio usage it's max 50 CPU load – hannes ach Dec 29 '20 at 21:48
  • You mean it turns on the fan on your new Mac or the old Mac? – Alexander Suraphel Dec 29 '20 at 21:51
  • 1
    On the new one ! But this is the only task which turns it on – hannes ach Dec 30 '20 at 06:33
  • Got you! So by Android Studio usage you mean also the emulator, right? – Alexander Suraphel Dec 30 '20 at 11:07
  • 1
    Right. Open in Android Studio 5 apps at the same time, sync and build it, uses not more then 50 % This means the bottleneck is somewhere else – hannes ach Dec 30 '20 at 11:32
  • cool! thanks. Just wanted to know if the Macbook Air I ordered will have issues with running the emulator for long duration... – Alexander Suraphel Dec 30 '20 at 11:45
  • I also have a M1 Macbook Pro. I have been using qemu for arm64 on macos for months. It works but the performance really sucks. Why? Because qemu is software-layer emulating without hardware acceleration. But this is what we can have currently with the issue of lagging and unknown bugs. Only if once VM products supported the Apple Virtual Framework, we would experience smoothly. – dotslash May 10 '21 at 14:00
  • My arm64-v8a Emulator is very fast, so qemu is a bad option – hannes ach May 10 '21 at 15:25
  • It seems your language must be English, otherwise you won't see the arm version – Fangxing May 17 '21 at 07:07
  • But , this is not the stable release isn't it? Can you use something like this this on production? – PeakGen Jul 01 '21 at 15:09
  • @JustCause A lot of stuff is working fast. Current this doesn't work: NDK, kapt (like Room) – hannes ach Jul 01 '21 at 16:28
  • @hannesach How about the SDK installation? Everything is okay there as usual? Because I'm using Android Studio only for the sake of having the SDK. My IDE is VS Code. Also when this is available in the stable channel, do you know whether you can directly update this or you have to do a fresh install? – PeakGen Jul 01 '21 at 16:45
  • @JustCause I see no issue with SDK installation, all is normal. But i don't use VS Code – hannes ach Jul 02 '21 at 04:30
  • @hannesach: Great. how is your exprience with the Google maps? Google say it is not working in iOS simulator yet, but works on real device. – PeakGen Jul 02 '21 at 04:56
  • Does july 27 update means that NDK projects is still not working? Thanks – StayCool Aug 06 '21 at 21:35
  • @StayCool NDK still runs into `Unknown host CPU architecture: arm64` on my side. For this you need the x86 variant, there it works – hannes ach Aug 07 '21 at 04:54
  • @JustCause Sorry I missed your Google maps question. Yes, it's working properly with M1 – hannes ach Aug 20 '21 at 05:28
  • Can u please check this https://stackoverflow.com/questions/68919616/android-studio-error-connection-react-native ? – Oliver D Aug 25 '21 at 18:27
  • It is still lagging when typing code and code completion... bad performance overall. – Philip Aug 26 '21 at 20:44
  • 1
    @Philip I only see it in x86 variant. Do you use right arm64 java ? You can choose it in preferences within Gradle settings – hannes ach Aug 27 '21 at 04:39
  • I deleted Android Studio and downloaded it again. I‘ve must have overlooked the option to download a Mac M1 x86+arm64 variant. When I had downloaded it before, it probably chose the Intel Version. I now have a little indicator inside the splash screen mentioning arm64 preview. Now code completion runs smoother overall. – Philip Aug 27 '21 at 08:41
  • BEWARE that even if it's working, you may find that the M1 version fails to install properly with the error "[An error occurred while trying to compute required packages](https://stackoverflow.com/questions/69869181/error-about-android-studio-on-macbook-m1-an-error-occurred-while-trying-to-comp)." A workaround is available at that link. – Dan Fabulich Nov 11 '21 at 20:24
  • Just wanna say thanks, you saved my day. I'm currently developing an android app on Macbook Pro M1 2020. And I constantly get crash while running Android Emulator. – MaiTruongSon Dec 11 '21 at 19:08
  • These steps didn't work for me, unfortunately. The emulator process for AVD Nexus_5X_API_30 has terminated. – Justin Dec 12 '21 at 21:49
  • I am also facing the similar problem "the emulator process for avd pixel_4a_api_30 has terminated" while trying to use x86 or x86_64 images. But I can run arm-64 images just fine. Any idea about this? – Imranur Rahman Jan 07 '22 at 05:35
  • @ImranurRahman Simply use arm-64 images – hannes ach Jan 07 '22 at 05:59
  • @hannesach In my case, I need to use an x86 or x86_64 system image to run a specific application. – Imranur Rahman Jan 07 '22 at 06:35
  • This worked for me ! thanks a lot, I waste a lot of time trying to get the solution. – Gonzalo GM Jun 02 '23 at 14:39
72

This fixed my issue

Tools -> SDK Manager -> SDK Tools (tab) -> Deselect 'Android Emulator' -> OK

Now, when you try to run your app, or launch device from AVD Manager, it will give the 'Install Emulator' error -> Click Ok. This will automatically download the correct version.

Dipanker Shah
  • 2,789
  • 2
  • 8
  • 4
14

I've had this problem with my new Macbook Pro M1 Pro (Macbook Pro 2021 14 Inch M1 Pro). after some digging around, the root of the problem was that I have transferred all my data from my old Mac (using Time Machine) which uses Intel (The other Mac is Macbook Pro 2011 13 Inch Intel), so other than a lot of apps which did not run or ran sluggishly and I had to reinstall their ARM version, the Android SDK Tools were transfered too.

So here are the simple steps to the solution:

  1. Launch Android Studio
  2. Select SDK Managerenter image description here
  3. Go to SDK Tools tabenter image description here
  4. Untick All the Packages, and keep them in your mind because you will retick them in the next step
  5. You will have a dialog something like this, Select Apply. This way now you've uninstalled the old packages enter image description here
  6. retick all packages (to reinstall their ARM version) and click apply, this may take some time depending on your internet speed as you are reinstalling all the packages
  7. Try launching the emulator now, if the problem is not fixed, try restarting Android Studio or your laptop completely, My problem was fixed without restarting though
Adnan
  • 906
  • 13
  • 30
11

If everything fails try this:

On Android Studio uncheck emulator -> tools -> Launch in a tool window

enter image description here

Got this from this official issue thread (by jeanlst):

https://github.com/google/android-emulator-m1-preview/issues/76#issuecomment-1023563846

Renato Probst
  • 5,914
  • 2
  • 42
  • 45
9

I followed the steps that this guy talks and had good results: https://medium.com/mobile-app-development-publication/my-journey-to-setup-android-emulator-for-m1-macbook-pro-b8365321b3e7

  • Go to AVD Manager
  • Click "+ Create Virtual Device"
  • Choose a Device definition (ex. "Pixel 4a XL")
  • Click "Next"
  • Click "Other images"
  • Download "S" System image
  • Click "Next"
  • Click "Finish"
Flavia Cohen
  • 91
  • 1
  • 2
  • 1
    I followed this too, but then I got stuck on the "Waiting for devices to come online.." error. Basically, my emulator works, and I can run my Gradle build, but then my app itself never runs on the emulator. After 300s, Android studio times out saying it can't find a device, and `add devices` shows my emulator as offline. Did you have something similar happen? – Tarun Sharma Nov 12 '21 at 07:52
  • I am having same error. – Rajshekhar Nov 12 '21 at 11:37
  • I can see the system image names like 'S' 'R', what does those 'S' 'R' means? – ximmyxiao Jul 02 '22 at 01:08
7

Steps to run your Android APP on M1

Finally my Android APP running normally on my M1 chip !

This presume you already have your environment variables set.

  1. Download Android Studio Arctic Fox (2020.3.1) Link (I personally got the last I could September 1, 2021)

  2. Install and open Android Studio

  3. Tools -> SDK Manager

  4. Check the box of Android 12.0 (S) and click Apply

    ... Wait until it's downloaded

  5. Tools -> AVD Manager -> click Create Virtual Device

  6. Choose any device that has the Play button and click Next

  7. Choose the image S. If you can't find it in the Recommended tab click on Other Images

  8. Final step click Next and Finish

You should now be ready to go.

crg
  • 4,284
  • 2
  • 29
  • 57
4

1. First, delete the android studio completely from your Mac system using the following command one by one:

rm -Rf /Applications/Android\ Studio.app  
rm -Rf ~/Library/Preferences/AndroidStudio*  
rm -Rf ~/Library/Preferences/com.google.android.*  
rm -Rf ~/Library/Preferences/com.android.*  
rm -Rf ~/Library/Application\ Support/AndroidStudio*  
rm -Rf ~/Library/Logs/AndroidStudio*  
rm -Rf ~/Library/Caches/AndroidStudio*  
rm -Rf ~/.AndroidStudio*  
rm -Rf ~/.gradle  
rm -Rf ~/.android  
rm -Rf ~/Library/Android*  
rm -Rf /usr/local/var/lib/android-sdk/

To delete all projects:

rm -Rf ~/AndroidStudioProjects 

2. Download the new Android studio using the below link:

https://developer.android.com/studio#downloads:~:text=android%2Dstudio%2D2021.2.1.15%2Dmac_arm.dmg

3. Now install that software, create an emulator using arm version and open that emulator.

  • I transferred to a new M2 mac from an Intel mac. When I first opened Android Studio it prompted me to install the ARM version. I did, but couldn't get any emulator to run, even after following the other tips in this thread. After completely uninstalling, as mentioned in this post, did the emulator finally run. – miker Apr 28 '23 at 14:59
3

You can now download the Android Studio Canary. In which you can run the android emulator with out any limitation of the android emulator m1 preview. In android emulator m1 preview there are issues with webview , device skin, sound etc..now you dont have to worry about that

Here is the link

https://developer.android.com/studio/preview?gclid=CjwKCAjwm7mEBhBsEiwA_of-TKIWfjv-MVe5W1Za_KcooZ-vfZ3vG_IkUyK40E-x10JLRRgnGjBCDBoCMOgQAvD_BwE&gclsrc=aw.ds

Sabiq Thottoly
  • 351
  • 5
  • 10
  • Yes, but after an update it stops working for me. In the meantime I did https://github.com/741g/android-emulator-m1-preview/issues/10#issuecomment-773545412 and now I'm able to use it seamless again – hannes ach May 02 '21 at 20:53
  • Oh, but its working fine for me. Previously with android emulator m1 preview i had issue with the webview and sound. But now its all fixed for me with this Android Studio Canary release – Sabiq Thottoly May 03 '21 at 01:18
3

as @Dipanker Shah reply, unclick the Android Emulator and run the AVD. After that... android studio will pop a warning screen and press OK. IDE will download the correct version.

Uncheck the Android Emulator and apply which will delete the existing files, and Recheck it and apply for new installation which will download compatible Android Emulator for M chips. 1

Jashan PJ
  • 4,177
  • 4
  • 27
  • 41
rraayy
  • 31
  • 4
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 18 '22 at 16:39
  • 1
    Reinstalling the emulator via unticking/reticking was what got it to work for me! Thanks. – David Rees Dec 19 '22 at 23:34
  • Success !! My Android Studio Dolphin | 2021.3.1 Patch 1 faced the same issue with M1 Pro. By Deleting (unchecking) existing Android emulator and reinstalling (by checking) solved the issue. Thank you @rraayy for clarity. – Jashan PJ Jan 10 '23 at 01:34
2

For me I can run the emulator on my MacBook Pro MacOS Big Sur with ARM CPU M1 only on Android Studio Arctic Fox (2020.3.1 Beta03 and later versions) only after deleting Intel x86 Emulator Accelerator (HAXM installer).

2

After I install the latest AndroidStudioPreview for Mac M1, it already included a default simulator with arm64-v8a ABI. However, this simulator still not loaded by AndroidStudio

When I tried to run adb from Terminal, it shows adb: command not found. So I config the adb

  • I set adb environment variable follow this answer
  • After that, when I run adb, I get the error zsh: bad CPU type in executable
  • Then I fix it by softwareupdate --install-rosetta (follow this answer)
  • Restart Terminal, then adb command working well
  • Restart AndroidStudio, then it able to see and run app to simulator
Linh
  • 57,942
  • 23
  • 262
  • 279
1

Now It's available

Apple Silicon Support

Android Studio Arctic Fox Canary 15 contains preliminary support for Apple Silicon (arm64). This version of Android Studio for this platform is still under active development, but we wanted to get a functional version out to the app developer community to get feedback. On top of the Intellij build, design tools work, and the Android Emulator works with API 30 and API S Developer Preview emulator system images.

Click here to Download

FGH
  • 2,900
  • 6
  • 26
  • 59
1

This works for me with Android Studio 2020.3.1:

  1. Tools -> AVD Manager -> click Create Virtual Device
  2. Pick any one of the Hardware that has Play Store, e.g. Pixel 4
  3. Click Other Images tab, download and select the S API Level
  4. Click Next and Finish

Then you're good to go!

I don't have any issue so far with the performance of my emulator which is nice.

Source/Credit to author of: https://medium.com/mobile-app-development-publication/my-journey-to-setup-android-emulator-for-m1-macbook-pro-b8365321b3e7

Jiyeh
  • 5,187
  • 2
  • 30
  • 31
1

Simple answer for M1 :

  1. Uninstall Android studio
  2. Delete all related files, check (Vikas Awate's answer @ https://stackoverflow.com/a/72564826/1489088) :
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*  
rm -Rf ~/Library/Preferences/com.google.android.*  
rm -Rf ~/Library/Preferences/com.android.*  
rm -Rf ~/Library/Application\ Support/AndroidStudio*  
rm -Rf ~/Library/Logs/AndroidStudio*  
rm -Rf ~/Library/Caches/AndroidStudio*  
rm -Rf ~/.AndroidStudio*  
rm -Rf ~/.gradle  
rm -Rf ~/.android  
rm -Rf ~/Library/Android*  
rm -Rf /usr/local/var/lib/android-sdk/
  1. Re-install Android Studio Arctic Fox (check for the latest version here) : https://developer.android.com/studio/archive

Everything will work much better after that. Inspired from crg's answer : https://stackoverflow.com/a/69088485/1489088

Karim Mortabit
  • 692
  • 2
  • 9
  • 19
0

It is not clear exactly what problems Google has had that they still have no way to release the M1 version. I got the DTK M1 almost a year ago. I think Google got it even earlier. Yes, there was a problem with emulation, but everything else in the IDE could definitely be done.

At least a loner did it without too much trouble. There is roughness, but the speed of work is different from sky and earth. Working with a regular Android Studio on M1 is almost impossible, and even with this refinement amateur, everything flies like lighting.

Here is the link: https://github.com/dsa28s/android-studio-apple-m1

This is an unofficial canary version of Android Studio Arctic Fox with emulators on the Apple Silicon. I'm using it and it works well in most cases.

0

Android Studio now has an official production release that supports the ARM chip. 2020.3.1.26

monchisan
  • 590
  • 8
  • 24
0

For me none of the solutions worked. Tried Arctic fox, bumblebee and etc. The only thing that worked was the Dolphin canary version. As you install this version, it gives you a default emulator but it's also possible to create a new one without any issue. Of course, there could be issues (because its canary ver.) but I'm happy that I can run something at this point.

Hoon
  • 637
  • 5
  • 10
0

In the emulator window (when all emulator tabs are closed) click on "Update" link and update developer tools.

tatiana_c
  • 948
  • 7
  • 16
  • 31
0

I ended up doing this Hack to manually install the emulator from the Dev Documentation https://developer.android.com/studio/emulator_archive

joe
  • 323
  • 1
  • 9
0

When you have this problem now with an M1 or M2 Chip and you have transfered your android studio with the copy-functionality from an old Intel Mac, check that you also uninstall the Haxm-part of the emulator. This was my problem. In my case I also wasn't able to remove that easily,thats why I deleted everything from android studio on my Mac and reinstalled after that. Then everything worked like a charm.