androidandroid-studioandroid-emulatoradb

Facing an emulator issue in Android: "Error: Device is Already Activating"


I have updated my Android SDK from API 32 to API 34. Currently, after updating I am facing an issue where I am unable to start the emulator. However, I am able to run my application on a real device.

Message that I get when I start the emulator:

Error running app: Device is Already Activating

I have tried this link but seems to be not resolvable the error for me: https://medium.com/@gvpraveen.ravi/resolving-the-device-is-already-activating-error-a-step-by-step-guide-to-fixing-adb-conflicts-32cb9438c816

I tried re-creating the emulators, reinstalled the Android SDK but still facing the same issue.

enter image description here

enter image description here

I have checked the Android studio logs but I couldn't completely understand it. What can I try next?

Android Studio version: Android Studio Jellyfish | 2023.3.1

2024-05-20 11:21:52,267 [ 352923] SEVERE - #c.i.o.p.Task - Device is already activating com.android.sdklib.deviceprovisioner.DeviceActionDisabledException: Device is already activating at com.android.sdklib.deviceprovisioner.LocalEmulatorProvisionerPlugin$LocalEmulatorDeviceHandle$internalStateFlow$1.invokeSuspend(LocalEmulatorProvisionerPlugin.kt:417) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684) 2024-05-20 11:21:52,273 [ 352929] SEVERE - #c.i.o.p.Task - Android Studio Jellyfish | 2023.3.1 Build #AI-233.14808.21.2331.11709847 2024-05-20 11:21:52,273 [ 352929] SEVERE - #c.i.o.p.Task - JDK: 17.0.10; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 2024-05-20 11:21:52,274 [ 352930] SEVERE - #c.i.o.p.Task - OS: Windows 11 2024-05-20 11:21:52,274 [ 352930] SEVERE - #c.i.o.p.Task - Last Action: Run 2024-05-20 11:21:52,563 [ 353219] INFO - #o.j.p.g.GradleManager - Instructing gradle to use java from D:\TW\Tools\Java 2024-05-20 11:21:52,664 [ 353320] INFO - #com.android.tools.idea.diagnostics.error.AndroidStudioErrorReportSubmitter - Exception signature: com.android.sdklib.deviceprovisioner.DeviceActionDisabledException at com.android.sdklib.deviceprovisioner.LocalEmulatorProvisionerPlugin$LocalEmulatorDeviceHandle$internalStateFlow$1.invokeSuspend-cf11dc37, report ID: b02f79cdb6cff2f3 2024-05-20 11:21:56,989 [ 357645] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities to files


Solution

  • Error running app: Device is Already Activating.


    There are different ways to fix this problem:

    1. Delete .lock Files

    Navigate down to the arrow and follow it to click on this link indicating Show on Disk as shown in the attached image.

    enter image description here

    It will list all the files in the directory you are in, including the one that caused the problem, the “hardware-qemu. ini. lock” file, and then you run it again. Files that need to be deleted should be the one with ‘. lock’ in its file name.

    enter image description here

    Go to (Windows)

    C:\Users{username}.android\avd/Nexus_5X_API_26.avd

    Or (Ubuntu)

    ~/.android/avd/name.avd/Nexus_5X_API_26.avd

    Or (Mac M2)

    /Users/{username}/.android/avd/Pixel_2_API_32.avd/hardware-qemu.ini.lock

    2. Stop AVD

    AVD Manager should be opened, the right-click at the down-arrow and select stop AVD. You do not need to restart or recreate the emulator in order to get rid of this type of problem.

    enter image description here

    You may get into error saying File in Use when deleting multiinstance.lock file.

    enter image description here

    In that case open Window's task manager(activity monitor in Mac) and selected qemu-system-x86_64.exe and press End task

    Windows :

    https://i.sstatic.net/Mi39y.png

    Mac :

    enter image description here

    3. Kill Simulator Task

    Windows

    taskkill /F /PID /PIDnumber

    Mac/Windows

    adb emu kill

    adb kill-server

    4. restart the computer

    This is the last option

    Note :

    I would suggest to use android studio hedgehog and ignore Android Studio Jellyfish for now till development team fixes it. The problem actually arise in low end systems of windows and Mac having SATA SSD and with NVME SSD android studio doesn't gives this type of error and solution I had provided is an alternative to it.

    Reference links :

    1. https://developer.android.com/studio/releases/fixed-bugs/studio/2023.3.1

    2. https://developer.android.com/studio/run/managing-avds

    3. https://developer.android.com/studio/run/emulator