Android Development on M1 Mac. This is how it should be done!

ishanknijhawan
5 min readJul 18, 2021

--

If you are an Android developer like me, you must have felt the pain of building Android apps on your laptop at some point of time. Don’t get me wrong, Android Studio is an excellent software, but it can’t just run on any device like VS code. My previous laptop was an old school HP device with 4GB RAM and 1TB HDD (yeah you are free to laugh). When I tried running Android Studio, it SUCKED! (obviously). So I installed an additional 16GB RAM and a 256 gigs SSD and it was a night and day difference, but still for bigger projects, it took around 3 – 4 minutes every time you run the app. Let alone changing branches or building APKs.

I was looking for an upgrade, and wanted a mac this time. My immediate thought was Yeah! M1 should be the perfect purchase, yes. Better performance, excellent battery and what not. But my thoughts were destroyed shortly after I got to know that Android Studio is yet to be built for M1 chip. Currently it runs on Rosetta.

Still. I thought how bad it could be, and the other perks in M1 were simply hard to ignore. And I went ahead with purchasing the 16gb variant.

Initial impressions from moving to my M1 mac from a windows laptop were very good. The display, trackpad, speakers and battery were all excellent. After installing Android Studio and cloning my project from GitHub, I immediately noticed some things, The build times was significantly better than expected, but the general coding experience was not good at all. The scrolling was lacking, autocomplete was taking too long to come and frame drops were hugely noticeable everywhere.

The laptop was getting extremely hot from the bottom and when I checked my Activity monitor, Android studio was taking almost 12gb of ram. Sometimes even 14gb. Which was insane.

Android Studio taking almost 12gb of RAM

It was not good. Although I was able to build my apps fast, the coding on this laptop was a real pain. I tried finding some alternatives and searched on google.I didn’t want to go for the Canary build as it’s still not stable and I’ve experienced some bugs in the past. Then I thought, Hold On!

Android Studio is made by JetBrains (Yeah So..)

IntelliJ is made by JetBrains (Umm okay..)

IntelliJ is optimised for M1

IntelliJ supports Android development (Woahhh…)

That’s it. This is the way! I immediately installed IntelliJ Idea Ultimate Edition. Now, before you jump and do the same. Be careful when installing, you have to select M1 installer, by default it installs for intel. (I made that mistake that’s why warning you 😛). You can install either version out of Ultimate and Community. But if you are working with room database, I recommend you downloading the ultimate version as I faced some problems in the Community one. You can use Ultimate version for free if you’re having any university email ID or GitHub pro subscription.

make sure to select the .dmg (Apple Silicon) variant before installing

After downloading and running it. You can also check from your Activity Monitor if you have installed the Apple version or intel.

Now, if you try building a new project. It will work fine, but cloning an existing project might have some issues which I faced in while setting up the project.

This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 4.2 or newer.

To fix this. Simply go to your build.gradle and replace

refer this answer if still facing any issues. Another issue you might face can be this one

SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/ishanknijhawan/IntelliJIDEAProjects/powerplay-fieldapp-android/local.properties'.

The error simply says the solution, all you have to do it add this file in your root folder

Replace my name with your username and you’re good to go! Another things you could do is go to Preferences -> Editor -> Code Style -> XML and check the Use custom formatting settings for Android XML files option. This way all the XML files will have android formatting.

Now, talking about general performance. It’s a LOT better than Android studio. You’ll feel it the minute you’ll start using it. It also takes less RAM and doesn’t overhead your Mac. Now you don’t have to wait for Android Studio to release optimised version for M1 mac because you’re already set! There was a minor issue I faced in IntelliJ though, the Logcat was not showing any logs. It’s not a major problem for me as I use debugger anyway.

As you can see, IntelliJ takes a lot less RAM than Android Studio

So Yeah! This is the way you should do Android development in M1 Mac as of now. Install IntelliJ and thank me later ✌🏻

Thank you and Happy Coding!

--

--