<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Afzal's Compositions]]></title><description><![CDATA[Afzal's Compositions]]></description><link>https://afzal.me</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 13:27:35 GMT</lastBuildDate><atom:link href="https://afzal.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to use Android's x86 emulators on M1 Macs]]></title><description><![CDATA[Aug 24, 2022: Android Automotive emulator for API 32 is now available!

July 13, 2022: Emulators for Android 5.x and 6.x (API 21-23) have also been released now!



April 28, 2022: Android and Google TV emulator for API 31 and 33 are now available fo...]]></description><link>https://afzal.me/how-to-use-androids-x86-emulators-on-m1-macs</link><guid isPermaLink="true">https://afzal.me/how-to-use-androids-x86-emulators-on-m1-macs</guid><category><![CDATA[Android]]></category><category><![CDATA[android app development]]></category><category><![CDATA[Apple]]></category><dc:creator><![CDATA[Afzal Najam]]></dc:creator><pubDate>Fri, 11 Feb 2022 19:18:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1644606346364/pFZhQ19Nd.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<ul>
<li><p>Aug 24, 2022: Android Automotive emulator for API 32 is now available!</p>
</li>
<li><p><em>July 13, 2022: Emulators for Android 5.x and 6.x (API 21-23) have also been released now!</em></p>
</li>
</ul>
<ul>
<li><p><em>April 28, 2022: Android and Google TV emulator for API 31 and 33 are now available for Apple Silicon!</em></p>
</li>
<li><p><em>April 4, 2022: Emulators for Android 7.x and 8.x (API 24-27) have been released!</em></p>
</li>
</ul>
<ul>
<li><em>February 21, 2022: Wear OS 3 emulator for Apple Silicon is now available!</em></li>
</ul>
</blockquote>
<p>So you bought that shiny new M1 Mac despite reading about <a target="_blank" href="https://github.com/android/ndk/issues/1299">some</a> <a target="_blank" href="https://issuetracker.google.com/issues?q=apple%20silicon%20m1%20status:open">drawbacks</a> for Android development and now you're wondering "how the heck am I gonna run all the emulators that aren't supported on this?"</p>
<p>Well, you've come to the right place! But first, let's see what doesn't work and what to expect in the future. Here are the emulators that cannot run on the Apple silicon as of writing this:</p>
<ul>
<li><p><s>All Android TV emulators.</s>* (see update above)</p>
</li>
<li><p><s>All Wear OS emulators.</s>* (see update above)</p>
</li>
<li><p><s>All Android Automotive emulators.</s> * (see update above)</p>
</li>
<li><p><s>Android 8.1 (API 27) and below.</s>* (see update above)</p>
</li>
</ul>
<p>While <a target="_blank" href="https://issuetracker.google.com/issues/203238268">Android TV</a> emulator images are eventually going to arrive this year, API 23 and lower will never be supported.</p>
<p>What if I told you that you can run and <em>debug</em> them from your new Mac today, granted you have another x64 computer lying around.</p>
<p>For the purpose of this article, we'll call the computer running the emulator, the host PC, and the computer running Android Studio, the guest PC. We will do it on a Windows host but it <em>should</em> work the same way on a Linux or macOS host.</p>
<ol>
<li>First, enable Remote Desktop on the host PC. It's in the Settings app on Windows 10 and 11.</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1642824348986/r5FriC1Vu.png" alt="Remote Desktop setting on Windows 11" /></p>
<p>If, like me, your host PC needs to be available for other people to use at the same time you need to run the emulator, check out the instructions <a target="_blank" href="http://woshub.com/how-to-allow-multiple-rdp-sessions-in-windows-10/">here on how to allow multiple sessions in Windows 10 and 11</a>.</p>
<ol>
<li><p>Install Android Studio on both computers. It's not strictly necessary to do it on the host PC since you can create and run the emulator using command line, but we're just doing it for simplicity.</p>
</li>
<li><p>Download and create the emulator you want on the host PC. For example, I created an Android TV emulator on my Windows machine.</p>
</li>
<li><p>On the host computer, setup an SSH server. On Windows, an easy way is to install OpenSSH server using PowerShell.</p>
<pre><code class="lang-elm"> <span class="hljs-type">Add</span>-<span class="hljs-type">WindowsCapability</span> -<span class="hljs-type">Online</span> -<span class="hljs-type">Name</span> <span class="hljs-type">OpenSSH</span>.<span class="hljs-type">Server</span>~~~~<span class="hljs-number">0.0</span><span class="hljs-number">.1</span><span class="hljs-number">.0</span>
</code></pre>
</li>
<li><p>Start the service.</p>
<pre><code class="lang-elm"> <span class="hljs-type">Start</span>-<span class="hljs-type">Service</span> sshd
</code></pre>
<p> Make it run automatically on startup (optional).</p>
<pre><code class="lang-elm"> <span class="hljs-type">Set</span>-<span class="hljs-type">Service</span> -<span class="hljs-type">Name</span> sshd -<span class="hljs-type">StartupType</span> <span class="hljs-string">'Automatic'</span>
</code></pre>
</li>
<li><p>Confirm that the firewall rule is set. It should be created automatically during setup. Run the following to verify:</p>
<pre><code class="lang-elm"> <span class="hljs-keyword">if</span> (!(<span class="hljs-type">Get</span>-<span class="hljs-type">NetFirewallRule</span> -<span class="hljs-type">Name</span> <span class="hljs-string">"OpenSSH-Server-In-TCP"</span> -<span class="hljs-type">ErrorAction</span> <span class="hljs-type">SilentlyContinue</span> | <span class="hljs-type">Select</span>-<span class="hljs-type">Object</span> <span class="hljs-type">Name</span>, <span class="hljs-type">Enabled</span>)) {
     <span class="hljs-type">Write</span>-<span class="hljs-type">Output</span> <span class="hljs-string">"Firewall Rule 'OpenSSH-Server-In-TCP' does not exist, creating it..."</span>
     <span class="hljs-type">New</span>-<span class="hljs-type">NetFirewallRule</span> -<span class="hljs-type">Name</span> <span class="hljs-string">'OpenSSH-Server-In-TCP'</span> -<span class="hljs-type">DisplayName</span> <span class="hljs-string">'OpenSSH Server (sshd)'</span> -<span class="hljs-type">Enabled</span> <span class="hljs-type">True</span> -<span class="hljs-type">Direction</span> <span class="hljs-type">Inbound</span> -<span class="hljs-type">Protocol</span> <span class="hljs-type">TCP</span> -<span class="hljs-type">Action</span> <span class="hljs-type">Allow</span> -<span class="hljs-type">LocalPort</span> <span class="hljs-number">22</span>
 } <span class="hljs-keyword">else</span> {
     <span class="hljs-type">Write</span>-<span class="hljs-type">Output</span> <span class="hljs-string">"Firewall rule 'OpenSSH-Server-In-TCP' has been created and exists."</span>
 }
</code></pre>
</li>
<li><p>Run the emulator you want to use on the host PC now.</p>
</li>
<li><p>Use ssh to forward port 5555 on the host PC to the guest PC. To do this, run this command where <code>192.168.2.12</code> is the IP of the host PC:</p>
<pre><code class="lang-bash"> $ ssh -NL 5555:localhost:5555 android@192.168.2.12
</code></pre>
</li>
<li><p>Go ahead and connect ADB.</p>
<pre><code class="lang-bash"> $ adb connect localhost
</code></pre>
</li>
<li><p>All that's left now is to authorize the computer on the emulator when the dialog popups up.</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1642826049999/O2u4NJt3C.png" alt="Android TV emulator showing a debug authorization dialog" /></p>
<p>If you followed the steps, Android Studio on your guest PC should see the emulator on the host PC. This allows you to run and debug the apps as if the emulator was running locally, circumventing architecture-specific limitations you might face on your M1 Mac.</p>
<p><em>Big thanks to</em> <a target="_blank" href="https://twitter.com/goncalossilva/"><em>@goncalossilva</em></a> <em>for proof-reading and providing feedback for this article!</em></p>
]]></content:encoded></item></channel></rss>