47

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.

KayFirst
  • 473
  • 1
  • 3
  • 5

9 Answers9

45

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.

Art Fedorychak
  • 684
  • 6
  • 6
  • this hack works. I am surprised why we need to do this hack Android studio should be able to handle it. Big thanks for both the question and answer. – Ashim Ghimire Nov 08 '21 at 06:28
  • 13
    This did not work for me, I have the same issue with the preview version. – tagy22 Nov 08 '21 at 22:34
  • Did not work for me, same issue also with latest Chipmunk canary version... I have Monterey OS – WizardingStudios Nov 09 '21 at 00:03
  • I managed to get some progress by downloading a much older intel only version, running that through the initial setup, and then closing that and switching to the latest arm version. I have not fully tested it, there could be some issues but it was the only way I could get it to work at all. – tagy22 Nov 09 '21 at 00:50
  • this did not work for me, none of the builds for any version released in the last 6 months worked on my m1. I shouldn't have deleted the sdk folder from a previous release. The intellij answers below worked for me – user3606123 Nov 10 '21 at 05:54
  • Thanks a lot its also work for me I have spent more then two days for new M1 Mac chip system to install it but this trick work for me to – Syed Hasnain Nov 11 '21 at 10:43
  • A number of folks are reporting that this trick isn't working for them. I was able to get the trick to work by [completely uninstalling Android Studio](https://stackoverflow.com/questions/17625622/how-to-completely-uninstall-android-studio-on-mac/18458893#18458893), then installing the Canary build to run its SDK manager, then running the stable build. (Surprisingly, when I tried to reproduce the old problem, I couldn't get the problem to recur even after completely uninstalling the stable build!) – Dan Fabulich Nov 11 '21 at 20:20
16

I tried over a dozen 2021 stable and Canary builds from https://developer.android.com/studio/archive and couldn't get any of them to work.

This is the only thing I could find that worked:

  1. Download, unpackage and run Android Studio 3.6.3 android-studio-ide-192.6392135-mac.zip from here.
  1. Proceed through the initial setup and let it download and install the SDK. Ignore any errors at the end.

  2. Delete this version and open the stable Android Studio like normal.

  3. You can now proceed through setup!

James
  • 181
  • 2
  • 7
  • Worked for me. But, apparently wrong JDK selected, and I was unable to accept the licenses with sdkmanager, as suggested by Android Studio. See https://stackoverflow.com/a/68751706/2605742 for that. – nachbar Nov 09 '21 at 04:11
10

I also faced this issue a couple days and I changed my mind to not use Android Studio. And It's fixed!

My alternative option is to download IntelliJ community edition and install Android SDK to your machine.

Image for IntelliJ Download Page

After (IntelliJ) installation is complete,

You need also to create new project, select android then download SDK. (thanks for @SteveRoger 's comment)

then open Android Studio again and follow its setup wizard. It will show that my machine has been already installed Android SDK and it can run perfectly at this time.

Hope this is an alternative solution for you. Have a great day.

keerati_ta
  • 101
  • 5
  • You are a genius. It worked like a charm, should be the correct answer. By the way, to complete the process not simply install IntelliJ, you need also to create new project, select android then download SDK. – WizardingStudios Nov 09 '21 at 14:18
  • @SteveRogers thanks ... i will update details by your comment. – keerati_ta Nov 09 '21 at 15:20
9

I solved the problem with these steps:

  1. Install the old Android Studio 3.6.3 (find the old Android Studio at https://developer.android.com/studio/archive)
  2. Install the Android SDK
  3. Overwrite the installation with the Apple Chip version of Android Studio
Kenji Wada
  • 341
  • 1
  • 10
  • 1
    Thank you so much , this solution worked for me . I have tried everything from last three hours but after trying your solution it finally worked. Thank you again for saving me . – abdemirza Nov 09 '21 at 07:53
  • 2
    This one actually worked for me. I have tried the one above, with the Canary build, but had the same problem as the version on the main page. – Andrei Nov 09 '21 at 09:13
  • Same story as the above commenters. Thank you! – mfletcher Nov 09 '21 at 13:41
7

I had the same problem with my MacBook air(m1 chip) as you mentioned. enter image description here

How did I solve it? Just download the IDE - Intellij IDEA and create a new project, select Android Project and there download Android SDK, now you can install android studio again and the sdk is installed.

enter image description here

enter image description here

Raman Kumar
  • 371
  • 3
  • 11
3

I've also had this exact same issue when downloading Android Studio 7.0.3. Here's what helped me.

  1. Download the command line tools, place them in the SDK folder (e.g., on mac: /Users/user/Library/Android/sdk), and then add the bin folder to the PATH.
  2. Install the latest platform: in a terminal, execute ./sdkmanager "platforms;android-31"
  3. Next up execute this command ./sdkmanager --channel=3 emulator (this switches the channel from stable=0 to canary=3 )
  4. Open Android Studio, and go to the SDK Manager (Appearance and Behavior > System Settings > Android SDK) Click on "Edit", and then select the sdk folder. Then "Next" > "Next" > "Finish".
  5. Now restart Android Studio and everything should work
Niklas
  • 23,674
  • 33
  • 131
  • 170
  • Works like charm. You may need to create the ` /Users/user/Library/Android/sdk` manually. And run the commands with `--sdk_root=/Users/user/Library/Android/sdk`. Ex: `sdkmanager "platforms;android-31" --sdk_root=/Users/user/Library/Android/sdk`, `sdkmanager --channel=3 emulator --sdk_root=/Users/user/Library/Android/sdk` – Mohamed Allal Nov 11 '21 at 10:08
2

I had the exact same error as OP. Follow what Art Fedorychak mentioned, it worked for me as well. It seems like the current stable build of the Apple M1 android studio version doesn't actually initialize an SDK if one doesn't already exist, but it seems to be able to update and or / initialize one that does as long as the same folder is being referenced, so we just need to use a working SDK for M1 on the initial run and then revert back to the stable AS

kkcodes
  • 21
  • 1
1

This is what solved it for me:

  1. Download & install IntelliJ IDEA. https://www.jetbrains.com/idea/download/#section=mac
  2. Open IntelliJ IDEA and create New Android Project
  3. Download sdk success
  4. Open Android Studio & checked it worked
1

My solution to this problem is simply to put the SDK in another location. For myself, I put the SDK folder to subfolders in Documents. The SDK download will initiate.

willnode
  • 1,377
  • 13
  • 17