47

Yesterday the emulator was working perfectly. The system image was arm64-v8a. I don't exactly remember the Release name of the working system image but, yesterday there was an update for the ARM 64 system image which I accepted and the release name is "S".

I can start the emulator from my AVD Manager, the emulator also starts when I press the 'Run app' button however, the app isn't loaded on the emulator and the emulator appears offline if I check through "adb devices" or if I click on "Troubleshoot Device connections" it shows:

"emulator-5554 - Device is currently in the offline state"

I have tried most of the suggestions found on StackOverflow like:

  • adb kill-server, adb start-server

  • Remove and re-create AVD device

  • Invalidate Caches/Restart

  • Enable USB debugging inside the emulator

  • Wipe data and cold boot from AVD manager

    I am using Android Studio 4.1.3

    Build #AI-201.8743.12.41.7199119, built on March 10, 2021 Runtime version: 1.8.0_242-release-1644-b3-6915495 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.16 GC: ParNew, ConcurrentMarkSweep Memory: 1981M Cores: 8 Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true Non-Bundled Plugins: org.jetbrains.kotlin

AVD:

Name: Pixel_4_API_S
CPU/ABI: Google Play ARM (arm64-v8a)
Path: ~/.android/avd/Pixel_4_API_S.avd
Target: google_apis_playstore [Google Play] (API level S)
Skin: pixel_4
SD Card: 512M
fastboot.chosenSnapshotFile: 
runtime.network.speed: full
hw.accelerometer: yes
hw.device.name: pixel_4
hw.lcd.width: 1080
image.androidVersion.codename: S
hw.initialOrientation: Portrait
image.androidVersion.api: 29
tag.id: google_apis_playstore
hw.mainKeys: no
hw.camera.front: emulated
avd.ini.displayname: Pixel 4 API S
hw.gpu.mode: auto
hw.ramSize: 1536
PlayStore.enabled: true
fastboot.forceColdBoot: no
hw.cpu.ncore: 4
hw.keyboard: yes
hw.sensors.proximity: yes
hw.dPad: no
hw.lcd.height: 2280
vm.heapSize: 256
skin.dynamic: yes
hw.device.manufacturer: Google
hw.gps: yes
hw.audioInput: yes
image.sysdir.1: system-images/android-S/google_apis_playstore/arm64-v8a/
showDeviceFrame: yes
hw.camera.back: virtualscene
AvdId: Pixel_4_API_S
hw.lcd.density: 440
hw.arc: false
hw.device.hash2: MD5:6b5943207fe196d842659d2e43022e20
fastboot.forceChosenSnapshotBoot: no
fastboot.forceFastBoot: yes
hw.trackBall: no
hw.battery: yes
hw.sdCard: yes
tag.display: Google Play
runtime.network.latency: none
disk.dataPartition.size: 6442450944
hw.sensors.orientation: yes
avd.ini.encoding: UTF-8
hw.gpu.enabled: yes

Any idea what has gone wrong? Or how to tackle this issue?

alex
  • 581
  • 1
  • 4
  • 7

4 Answers4

107

Replace the avd system images you have downloaded with the r02 images. r03 is broken for me but reverting to r02 saved the day!

Update: It appears r03, r04, and r05 all don't work on m1

Google Play ARM 64 v8a System Image (revision: 2)

Google APIs ARM 64 v8a System Image (revision: 2)

With the latest android (4.1.3) on macOS, the directory you want to put the unzipped images in is probably something like ~/Library/Android/sdk/system-images/android-S.

For example, the path for the google play image is ~/Library/Android/sdk/system-images/android-S/google_apis_playstore/arm64-v8a

AndrewPK
  • 6,100
  • 3
  • 32
  • 36
  • How did you find the older images? – Daniel Apr 29 '21 at 19:00
  • 4
    @Daniel - I just looked at the URLs that android studio was using to download the latest versions and tried rolling the revision number back to check if the old images existed at the URLs. current image was `https://dl.google.com/android/repository/sys-img/google_apis_playstore/arm64-v8a-S_r03-darwin.zip` so I just tested rolling that `r03` to `r02` in the URL. – AndrewPK Apr 30 '21 at 20:10
  • 4
    Solved the problem. Thank you! However if anyone else needs this, my path to arm64-v8a was: /Users/$user_name/Library/Android/sdk/system-images/android-S/google_apis_playstore/arm64-v8a – alex May 29 '21 at 11:34
  • 4
    r04 is broken as well. – Jim Jun 04 '21 at 14:41
  • 1
    You cannot even imagine how you helped me. Thank you a lot. Really, thank you from the bottom of my heart. – Bernard Jun 10 '21 at 20:44
  • The answer in the other question: https://stackoverflow.com/questions/64907154/android-studio-emulator-on-macos-with-arm-cpu-m1 solves the issue. Don't use the S variant when you're using the Artic Fox 2020.3.1 Android Studio Preview. Use the R variant and the emulator works fine – Zane Jun 15 '21 at 10:38
  • @Zane: for those of us ensuring that our software works with S using R doesn't solve our problem – AndrewPK Jun 21 '21 at 21:23
  • @AndrewPK Meanwhile revision 5 is available, did you try that one? – Ahmed Al Hafoudh Jun 22 '21 at 16:53
  • @AndrewPK ah. thats fair. Did not think about that. I tested revision 5 and it still shows up as offline. – Zane Jun 23 '21 at 00:44
  • @AndrewPK can confirm that on 2020.3.1 Beta 4 with Android Emulator 30.7.4 and the arm64-v8a-S-r05 + Pixel 4 XL Device, it no longer shows up as offline – Zane Jun 25 '21 at 15:58
  • Thanks very much. Mine was in: /Users/$user_name/Library/Android/sdk/system-images/android-S/google_apis_playstore/arm64-v8a for the Play Store device and /Users/$user_name/Library/Android/sdk/system-images/android-S/google_apis/arm64-v8a for non Play Store – zkwentz Jul 01 '21 at 19:21
  • so far, this is the only solution that actually worked directly from Android Studio and not using the preview emulator. – Mariano Zorrilla Jul 05 '21 at 16:01
  • So revisions 3, 4 and 5 don't work? Thanks a lot for the link for downgrading :) – Achim Jul 07 '21 at 15:24
  • Thank you! This was really confusing – Hiroshi Horie Jul 18 '21 at 13:52
  • 2
    r06 is broken as well. – norbDEV Jul 20 '21 at 10:35
  • Wow, it's really working! Been messing around with the M1 configuration for Flutter development for 3 days now (in the meantime Arctic Fox got released as stable) and couldn't solve the offline emulator state. Replacing the image with r02 solved the problem and can use the emulator again. Thanks a lot, I owe you like bag of monies for that. – Kamil Rykowski Jul 30 '21 at 08:57
  • Thank you a lot. Really, thank you from the deep of my heart – Rami Salim Aug 17 '21 at 13:59
  • THIS WORKED AS OF 11/09/2021 on M1 Mac – Wilfred Almeida Sep 11 '21 at 11:38
  • 2
    Work on 21/09/2021 on m1 mac! the only solution that work for me.. thanks ! – Bourdier Jonathan Sep 23 '21 at 22:00
  • When are they going to fix this? – user2619824 Nov 06 '21 at 00:31
  • 1
    Is it just me or is API 31 r8 broken as well? Does not work on my M1. – Bartek Pacia Nov 17 '21 at 01:04
  • @BartekPacia api31 r8 worked for me on mac m1 – Vincent Gagnon Jan 05 '22 at 19:46
  • upto latest release 9 is broken on Windows for Google Play Intel x86 Atom_64 System Image – Rohit Bhargava Nov 18 '22 at 05:31
11

If you are not use API level S, you can try this: (My API level is 31)

  1. Download from here

  2. Create a new folder as shown below, unzip the downloaded file and place it inside the new folder Image Path: /Users/<Username>/Library/Android/sdk/system-images/android-S/google_apis_playstore/arm64-v8a

  3. Launch Android Studio and click Configure > AVD Manager

  4. Click Create Virtual Device ..., select any device, press the Next button and confirm that API level S has been added.

  5. Add it to your devices and verify it works with VSCode. Image

user16217248
  • 3,119
  • 19
  • 19
  • 37
Tatsuhiko Mizuno
  • 437
  • 6
  • 15
3

I ran into a similar issue, not sure if you get it fixed, but I came accross this post when looking for solutions and the above solution didn't work for me.

A solution I did find out about was to install android-emulator-m1-preview from google, launch that instead of launching the emulator from inside Android Studio. Its almost annoying how simple of an issue it turned out to be to fix.

Seeing build successful after 12+ hours of trying different solutions is really nice.

Austin
  • 53
  • 6
  • The preview emulator worked well enough for quite some time, but with recent macOS Versions I've experienced network issues with it. Switching to the r02 API helped. – LyteFM Jul 27 '21 at 11:44
2

For mac M1 users, just delete the emulator and add another emulator. API level 30 worked for me

Bawantha
  • 3,644
  • 4
  • 24
  • 36