Setting Android Studio and JDK for Apple Silicon Architecture (M1 Chip)
Android Studio stable version is not compiled for Apple Silicon Architecture, then it will have to work behind Rosetta when run on Apple M1 devices. This will slow down the performance of the application. Slow build time and micro freeze everytime autocomplete shown
How to optimize Android Studio on Apple Silicon Architecture?
Download Android Studio Canary Version
For now, Android Studio stable channel is not compiled for Apple Silicon Architecture, but Android Studio preview release does. So we will use Android Studio Canary Build Bumblebee Canary 3
Note : since this is still canary build, please consider if some feature may not working properly
- Open this page https://developer.android.com/studio/archive
- Select latest canary build (for now Android Studio Bumblebee (2021.1.1) Canary 3)
- Download zip file for Mac (Apple Silicon) version and Install
Install Zulu Open JDK for Apple Silicon Architecture
Default openJDK that came up with Android Studio is not compiled for Apple Silicon as well, we will use Zulu Open JDK to optimize build on Apple Silicon Architecture
Installing Zulu OpenJDK
- Open Zulu download page https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk
- Select .dmg for Java 8 (LTS Version) and Install
Set Zulu OpenJDK as Default OpenJDK
- Open .bash_profile → nano ~/.zprofile
- Add JAVA_HOME → Add this line to .zprofile
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home
3. Save and Exit
4. Make sure your default openJDK is Zulu openJDK
Now our Android Studio and JDK already optimized to run on Apple Silicon Architecture
Nice to have : increate Android Studio memory setting
Help → Change Memory Setting
Result
Build Time : Intel 1.4GHz 8GB 2020 vs M1 16GB 2021 compile large Android Studio Project
Result may different between devices, this is just some random build check, it may not accurate, but lag and micro freeze during development already solved