Improve Android Development in Apple M1 Chip
Apple in November 2020 released the first Macs with an Arm-based M1 chip, debuting new 2020 13-inch MacBook Pro, MacBook Air and Mac Mini models. In 2021, Apple added the M1 iMac and the M1 iPad Pro. The M1 chip has received rave reviews for its incredible performance and efficiency.
Does it mean I should jump onto it for Android Development?
My Gear using Macbook Air
- 8 Core GPU
- 8 Gb RAM
- 512Gb Storage
However, we can configure the RAM to 16 GB, and with much larger storage e.g. 512 GB, which to me, is good enough for Android Development.
Behind this story, previously I find the solution to work fast and better with Android studio (CPU and RAM Usage) because when I using Android Studio 4.2.1 a bit laggy with a small project. So I find another article to improve android development inside Apple M1 Chip. There are my tips for all of you and my personal experience.
Download IntelliJ IDEA for Apple Silicon Support
Last release android studio is different performing with Intellij 2021. IntelliJ runs well and smoothly when compiling also open multi tabs browser. This IDEA runs better than the previous Android Studio 4.2.1. Recommended when you using MacBook Air 8Gb RAM or MacBook Pro 8 Gb RAM! ❤
Using OpenJDK support for Silicon Apple Chip
At the moment when I searching the article, I found this good article to speed up android compilation.
And that is real, I tried to download and setup my mac using Azul Zulu Arm64
You just download .dmg file and follow the instruction, after that add the path into your bash file, also add change the project JDK to Zulu.
And try to compile or running your project and let you see the architecture java at Activity Monitor change from Intel to Apple.
More Information
When you using Room Android you will have some trouble when run your project
Error opening connection No native library is found for os. name=Mac and os.arch=aarch64
It because room using jdbc version does not support Apple Silicon Chip. From the release documentation JDBC minimum version support Apple M1 is 3.32.3.3.
Open your app build.gradle and exclude jdbc module from your dependencies.
configurations {
all {
exclude(group = "org.xerial")
}
}
And add JDBC Module to your dependencies
implementation "org.xerial:sqlite-jdbc:3.32.3.3"
Try sync and build again your project. It will work like a charm. With better speed compilation and memory usage.
That’s it. You’ll reap the benefit of M1 for a speedier Android Development. Cheers!