Android Studio very laggy on M1 Apple Silicon chip - android-studio

I've upgraded to the M1 chip 2020 Macbook Air from a 7th gen. Intel chip pc. Overall, I'm very happy and content with it but when it comes to Android Studio performance, which I use quite often, it is very disappointing I'm sorry to say. When will an Apple Silicon compatible version be available? Are any of you guys have any clue?

I had the exact problem and the solution was as follows:
Open Android Studio, go to Help -> Edit Custom VM Options and add the following lines:
-Dsun.java2d.opengl=true
-Dsun.java2d.opengl.fbobject=false
Restart the IDE and wait for the files to sync. Done, IDE running smooth again.

Starting from Android Studio Artic Fox version, they not only changed versioning number style (replaced number system with Year-styling Version names), but also introduced Android Studio for M1/Apple Silicon (arm arch 64bits).
To check if you'r using right Android Studio for your M1, click on 'About Android Studio' and check the runtime, it should show as aarch64 (ie. Arm architecture 64bits). If not, mostly you might be having x86_64 if you installed regular Mac's Android Studio.
To switch to M1's Android Studio,
first exit already installed Android Studio, if it's open.
Go to Finder and under 'Applications', rename 'Android Studio' to preferably 'Android Studio_x86_64'.
Go to Android Studio downloads page (https://developer.android.com/studio#downloads), and download the one tagged as 'Mac (64-bit, ARM)' and unzip and move to 'Applications'.
Click to open 'Android Studio' from the Finder/Applications. You may drag and add it as a Dock shortcut option.
Good thing is that there is no extra installation required and the existing project, (at least for me), opened without any issues.
Android-SDK based and Flutter projects should be good right after switch, NDK not yet there.
AS is now faster again as you are using it as intended on Apple M1's chipset. !

Now Android Studio Bumblebee (2021.1.1) is available in Stable Channel. If your version is older than Bumblebee, download it for more performance.
I find out that the link shown by default is for intel architectures.
Automatic update performed by android studio also downloads the intel version even if this download occurs on a Mac with an ARM architecture (M1) .
You should navigate to the download options and choose ARM architecture manually.
You can download version 2021.1.1.22 Bumblebee for MAC ARM (M1) here (Link updated on Mar 7 2022 )

Check Android Studio Arctic Fox (2020.3.1) Beta 3 (have apple silicon support)
https://developer.android.com/studio/archive

use Intellij CE the latest version released on April 6th has native support for m1 and its very fast and intuitive, i've been using it and it's not very different from android studio
Edit: September 21
Download m1 native supported Android studio through https://developer.android.com/studio/archive
Download Mac (Apple silicon)

All the above did not work and my emulator was completely unusable but in my case the following fixed my issues:
Android studio Preferences > Tools > Emulator
Make sure 'Launch in a tool window' is checked
'Wipe Data' on emulator and then relaunch
Having the emulator launch as a separate window caused a huge slowdown but this fixed it immediately

Related

Why is Android Studio so slow after update to Android Studio Electric Eel | 2022.1.1 Canary 8

I have updated my Android Studio to
Android Studio Electric Eel | 2022.1.1 Canary 8
Build #AI-221.5921.22.2211.8786657, built on June 30, 2022
Runtime version: 11.0.13+0-b1751.21-8125866 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry:
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
ide.images.show.chessboard=true
Non-Bundled Plugins:
com.android.aas (3.5.1)
and now it is extremely slow to respond to any code change, e.g. it takes minutes to properly highlight any code following the simplest of refactors.
i have also noticed that it is showing git information within all my code files.
I do not know how i have configured this change, however i have a feeling its because of this git integration that my development is now painfully slow.
has anybody else experienced a degradation in responsiveness since updating to this latest version of android studio?
how can i get back to being able to be productive?
I upgraded to the release version of Electric Eel when it prompted me I have just gone to the downloads site to download Dolphin again as it's running really slowly.
I make a change and then sit and wait for it to take affect before I make another. I'm posting this as a warning as I found this thread when I was searching for why Electric Eel was so slow.
If you've done the same as me you can download the old versions at:
Android Studio Archive
Beacuse this is a Canary Build of Android Studio, the perfomance can not be expected to be on par with the other versions. The best thing you can do is to consider downgrading to Android Studio Dolphin until the new version is in stable release.
Also the sluggish performance can come from the new Live Code feature:
Live Code
that makes building obsolete. Due to the feature not being finished, it might be that the coding experience you have might be bad.
I upgraded last week to Electric Eel, but it is consuming almost 3GB, and even with that amount of memory it responds to a lot of tools VERY slowly (i.e. working on xml files)
It takes several seconds to show any option.
On the upside: Seems to me that contextual documentation loads faster.
Going back to Dolphin until this gets better.
UPDATE
To completely uninstall Electric Eel I had to download the zip file of an old Android version (old versions are in https://developer.android.com/studio/archive, I downloaded Android Studio 4.1 Canary 2) and use that uninstaller.
I installed Dolphin afterwards, but spent several hours trying to install my app in a physical device...Dolphin always got stuck in the build phase, but no message saying there was something wrong. I thought it was the ADB, but no, it was detecting correctly the phone. I tried with another app I developed and it worked OK.
So I decided to upgrade Dolphin to Electric Eel again, to see what changed, and after starting up Electric Eel showed a window saying that my project was built with AGP 7.3.1 but synced with 7.3.0. I synced it as recommended and I could install it again in the phone.
I post this in case someone faces the same situation...
Now I am again at Electric Eel, checking if it behaves better...

Android Studio [BumbleBee 2021.1.1] Emulator Timeout on Mac M1

I have Android Studio BumbleBee 2021.1.1 downloaded, running on a MacBook Pro M1. When downloading Android Studio, I chose the Apple Chip option (opposed to Intel)
I've created a Virtual Device - Android 12.0 arm64-v8a Pixel 4.
When I attempt to run the emulator it gets stuck here
Then, it times out:
I have searched SO and other blogs and can only find outdated material based on a time in 2020/2021 when Android did not support ARM64. However, it's my understanding that this has now changed so https://github.com/google/android-emulator-m1-preview is no longer needed.
What is the correct way to run the Android Emulator on a Mac with an M1 Chip?
I have found the issue so marking this as solved, however, if anyone knows why this solves the problem, please share!
I found an issue opened on Google's anroid-emulator-m1-preview repo with this answer https://github.com/google/android-emulator-m1-preview/issues/76#issuecomment-1023563846
Turns out, I just needed to uncheck 'Launch in a tool window' but again, not sure why that fixed the issue.

Android studio 4.1 Emulator extended controls

Extended control settings/options are missing in this update? like sending sms, gps settings unable to find the settings any help appreciated.
To see the additional options you need to run the Emulator in a separate window (process).
To do so go to File...Settings... and then choose the following.
You'll need to uncheck the Launch in a tool window option.
After you do that and restart Android Studio and start your emulator, it will run in a separate window and you'll see the options you want on the ellipse menu item on the side of the emulator.
Here's my Android Studio version info:
Android Studio 4.1
Build #AI-201.8743.12.41.6858069, built on September 23, 2020 Runtime
version: 1.8.0_242-release-1644-b3-6222593 amd64 VM: OpenJDK 64-Bit
Server VM by JetBrains s.r.o
Linux 5.4.0-52-generic
Current Desktop: ubuntu:GNOME
Edit: September 2021
Now, since Android Studio Arctic Fox (2020.3.1) you can enable that in settings:
And you have it there:
Old answer
TL;DR
Currently, you can't use
Why
Base on documentation:
https://developer.android.com/studio/run/emulator#limitations
Limitations
Currently, you can't use the emulator's extended controls when it's running in a tool window. If your development workflow depends heavily on the extended controls, continue to use the Android Emulator as a standalone application. In addition, certain virtual devices—such as Android TV and foldable devices—can't be run in Android Studio because they have specialized UI requirements or important functions in the extended controls.
After hours of struggling, I finally started my emulator using terminal-command and I was able to see the extended controls. Followed this answer, https://stackoverflow.com/a/45201495/6869086

Problem running the Android Studio emulator on AMD CPU

Recently I decided to learn android dev with Kotlin, I installed JDK, the latest Android Studio release and other stuff but my CPU is AMD so I cannot install intel's HAXM which is required to launch the emulator . I want to know if an equivalent for pc with AMD exist
For your problem there are several ways to fix the issue.
Android Studio with Android Emulator Hypervisor Driver for AMD Processors Tools(Recommended)
Here's the full document
Go to Android SDK -> SDK Tools -> Check Android Emulator Hypervisor Driver for AMD Processors also make sure if they're installed they're updated, since this solution got a problem with using NOX player at same time, and causing Blue Screen of Death
Then go to App & Features -> Turn windows features on or off -> make sure Hyper-V and Windows Hypervisor Platform are disabled. All Windows features enabling Hyper-V either explicitly or silently must be turned off.
Other solution is to use Nox or Bluestack emulator. i prefer nox since idk why but bluestack using so many resource, and also nox multi-instance is also working very well for using several emulators and it's got 3 version of android (4, 5, 7).
Common issues while using nox when trying to develop flutter app or etc is sometime emulator won't appear in your emulator list in android studio which the solution is that you should copy your adb nox file to your android sdk folder. or address the PATH VARIABLES to use nox adb.
Good Luck.

Android Studio 1.3 Preview NDK support

Yesterday Google announced that native code debugging is now possible with this version of Android Studio.
https://plus.google.com/+AndroidDevelopers/posts/2Gk6yrZKV4X
I've updated to the newest build version "AI-141.1962279" and can't see any possibility of debugging native code.
I've switched to build-tools 23.0-rc1, used gradle plugin 1.3.0-beta1 but cannot set breakpoints in native code or step into JNI calls.
Is it really working?
July 10th update Android Studio Preview with NDK support is available : https://sites.google.com/a/android.com/tools/tech-docs/android-ndk-preview
Android Studio 1.3.0-Preview is indeed available through the Android Studio "Check for updates" menu.
Unfortunately, all C++ features aren't available yet in this preview. They will be available in about 2 weeks.
Source : Google IO dev tools keynote at 35:38
Android Studio 1.3 Beta Available
posted Jun 19, 2015, 11:37 AM by Tor Norbye
Android Studio 1.3 Beta is now available in the beta channel! Sorry, this build does not yet contain the C/C++ support; we are still ironing out a couple of critical issues, but we hope to be ready in the next week or two. Similarly, the vector rasterization support is also still not enabled due to various bugs.
UPDATE:
the 9th of July update contains c++ debug
http://tools.android.com/recent
Even on the Canary Channel, the latest currenlty available build is 1.2.1.1. We will simply have to wait a bit longer for 1.3. The "About Box" in Android Studio also displays the version number; check that to be sure.
"As announced at Google I/O, Android Studio 1.3 will include C/C++ support as well, but that is not included in the first couple of preview builds."
Source:
https://sites.google.com/a/android.com/tools/recent/androidstudio13preview1available
FYI:
NDK support is included from Android Studio 1.3 RC1 on. This includes editing running and debugging C and C++ code. See Android NDK Preview and experimental Gradle plugin guide.
with Android Studio 1.4 release you could debug native JNI code. Your project need to use gradle plugin com.android.model.application though.
After you create a project with JNI code in it, this Android Studio version will create a debug Configuration (mine is called app-native)
once you select this configuration, you could set breakpoint in JNI code
then run your app with android studio [it will download and start app on device]
When JNI code is launched, Android Studio will break right away. You could set more breakpoint at this moment too
Then let debugger "go" [to continue ]
Your breakpoints will get hit
The gradle model plugin examples could be found from googlesamples/android-ndk on github. There is a youtube clip called HelloJniWithAndroidStudio shows how to create a hello-jni with android studio 1.3, most steps still work for 1.4 -- it might help for build.gradle creation.
Different version of gradle mode plugin requires different gradle version:
Gradle-Model-Plugin-version 0.2.0 works with Gradle Version 2.5
Gradle-Model-Plugin-version 0.3.0-alpha3 works with Gradle version 2.6
you could find out what versions are available from the jcenter links mentioned earlier.

Resources