Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error about Android Studio on Macbook M1: An error occurred while trying to compute required packages

I've downloaded Android Studio from the official website, the one for M1 chip (arm).

Basically running it for the first time, the error is the following:

An error occurred while trying to compute required packages 

I was searching about it the whole day to figure out a way to make Android Studio work, but that error keeps showing. Not completely sure if it's related to M1 Macbook, as on my Intel one it works as expected.

What I already tried to do:

  • Installing the command line tools, then placing it on SDK folder (Users/user/Library/Android/sdk). Then added the bin to the PATH (Reference)

    • After doing that, when executing the sdkmanager on terminal I get the following message Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli
    • Then I searched again and it leaded me to this thread, then as on the answers I tried to rename the folder, then other tries not related. I fell into many links and references that did not work at all.
  • After that I try to check what happens if I click on New Project, then the following is shown:

The Android SDK location cannot be at the filesystem root

  • As the message indicates, the issue is The Android SDK location cannot be at the filesystem root, so I searched again about it
    • I looked into that and got to a few links, for example this one and this one. Before doing that search I clicked on the Edit button, which lead me to the Android SDK to be updated/installed (Nice!), so I had to delete the content I had on Android folder (inside Library) and clicked next...then, I got the same message An error occurred while trying to compute required packages.
    • Then I thought "ok, maybe if I change the SDK location", so I changed to ../Documents/sdk, which ended up in the same result

Seems like no matter what I do, it ends up showing up that same message.

When I run java -version that's what I see:

java version "1.8.0_311" Java(TM) SE Runtime Environment (build 1.8.0_311-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.311-b11, mixed mode) 

Did anyone have the same issue? Am I doing something wrong? Not sure how to proceed from here, despite of the Android Studio version I download it's always the same result.

Any help is appreciated.

like image 651
KayFirst Avatar asked Nov 07 '21 01:11

KayFirst


People also ask

Can Android Studio run on Mac M1?

Android Studio is not M1 Optimized Yet The Software that runs on M1 Chip is no longer Intel Chip, and hence need to be M1 Optimized first. However, when we checked the latest Android Studio 4.1. 3 and Android Studio Preview 2002.1. 3 (Canary 14), it is still based on Intel architecture as shown below.

Can I run Android Studio on MacBook Pro?

To install Android Studio on your Mac, proceed as follows: Launch the Android Studio DMG file. Drag and drop Android Studio into the Applications folder, then launch Android Studio. Select whether you want to import previous Android Studio settings, then click OK.


1 Answers

This is what solved it for me on my M1.

  1. Go to Android Studio Preview and download the latest Canary build for Apple chip (Chipmunk). Don't worry this is just to get through the initial setup.
  2. Unpack it, run it, let it install all the SDK components, accept licenses, etc as usual.
  3. Once it's done, simply close it and delete it.

Now when you start your stable Android Studio (Arctic Fox) you should not see the error.

like image 180
Art Fedorychak Avatar answered Nov 12 '22 18:11

Art Fedorychak