3

I tried everything and I am running out of ideas to have an Android simulator working on my mac.


Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 16, 2022
  • I downloaded "the R API Level 30 image"

  • I installed "The Zulu OpenJDK" with

brew tap homebrew/cask-versions
brew install --cask zulu11

Edit: Following @mmBs advice, I changed the path to Gradle

Preferences > Build > Gradle > Gradle JDK > azul-11

gradle JDK

...same result.

I can't make the virtual device works on my machine.

enter image description here

I always have this device manager error when I try to launch the simulator.

enter image description here

Question:

How can I have an android simulator working with an Apple M1?

David Leuliette
  • 1,595
  • 18
  • 26

2 Answers2

3

What works for me:

  1. Install Android Studio from the official webpage for M1 processors and then install Android SDK in default location ~/Library/Android/sdk.
  2. Install java using brew - brew install openjdk@11 (android supports java 11, no needs for installing java 17 etc.) and then add it to the path.
  3. Set your android paths in zsh or bash:
# Path to Android SDK
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export PATH="$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/ndk-bundle:$PATH"
  1. Install the emulator image for arm --> arm64-v8a (from Android Studio's Device Manager).
  2. Done - it should be working. I use M1 processor and the emulator works just fine. You don't need any m1-emulator-preview from github.

Edit: you can check this thread as well: Android Studio/Emulator on macOS with ARM CPU M1

mmBs
  • 8,421
  • 6
  • 38
  • 46
  • Same error I created a new project and I don't know if it's related to this error ``` An exception occurred applying plugin request [id: 'com.android.application'] > Failed to apply plugin 'com.android.internal.application'. > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8. You can try some of the following options: - changing the IDE settings. - changing the JAVA_HOME environment variable. - changing `org.gradle.java.home` in `gradle.properties`. ``` – David Leuliette May 02 '22 at 14:19
  • Yeap, so you have an answer --> `Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.` You need to check your path for you project. 1. click 'cmd + ;' to open the a project structure. 2. Go to sdk location --> Gradle settings. 3. Choose gradle jdk (you can choose bundled jdk 11 from android studio). 4. click ok and it should be set. – mmBs May 02 '22 at 19:55
  • making progress here `09:41 Gradle build finished in 638 ms` but my main problem remains Android studio refuses to boot the virtual device —thanks for the input question edited – David Leuliette May 03 '22 at 07:46
  • ok, what emulator version did you install? Also, did you install HAXM? If yes, you should uninstall it. – mmBs May 03 '22 at 07:56
  • Btw have you checked this thread? https://stackoverflow.com/questions/64907154/android-studio-emulator-on-macos-with-arm-cpu-m1 – mmBs May 03 '22 at 07:58
  • 1
    Yes that was my starting point before posting here —I tried all Android ARM Images `arm64-v8a` from 10 to 12 – David Leuliette May 03 '22 at 08:08
  • 1
    `Intel_HAXM` was already removed, doubled checked with https://github.com/intel/haxm/wiki/Installation-Instructions-on-macOS#Removing_Intel_HAXM thank you for your support —I will give up on this – David Leuliette May 03 '22 at 08:24
1

this worked for me!!! Preferences->Appearance&Behavior->Android SDK->SDK Tools Check these..see pics enter image description here