Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Emulator PANIC Error

All of a sudden the Android Studio emulator has stopped working. When I attempt to run a virtual device, I get the following error in the Event Log.

Emulator: PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT Emulator: Process finished with exit code 1

So I checked to see what value the ANDROID_SDK_ROOT environment variable was set to, and it was empty. So I set it to /Users/{username}/Library/Android/sdk based on an answer to a similar question; but I still get the same error.

I tried deleting all of the virtual devices from the AVD Manager and creating a new one (as suggested here), but no luck. I also tried uninstalling and reinstalling all of the SDK component packages; I still get the same error.

I cannot figure out what happened, or how to fix it. Could the ANDROID_SDK_ROOT value I set be incorrect? (The value I set is the same as my ANDROID_HOME variable, which does point to the directory that contains the Android SDK).

The only thing I can think of that I haven't tried yet is to uninstall and reinstall Android Studio (I would rather try to avoid that if I can).


Update

Well... I deleted everything I could find relating to Android Studio.

~/.android
~/.AndroidStudio*
~/Applications/Android \Studio.app
~/Library/Android
~/Library/Application \Support/AndroidStudio*
~/Library/Caches/AndroidStudio*
~/Library/Logs/AndroidStudio*
~/Library/Preferences/AndroidStudio*
~/Library/Preferences/com.android.Emulator.plist
~/Library/Preferences/com.google.android.*

Then did a fresh install of Android Studio... and I'm still getting the same error. Did I miss something? What is causing this issue??

like image 326
Bryan Avatar asked Mar 01 '18 17:03

Bryan


People also ask

How to fix Android emulator not responding to games?

If your emulator is a device with the Google Play Services enabled, the error might be related to “OpenGL” to fix this, simply: Go to: Tools > Android > AVD Manager Press the “edit” (pencil) icon next to your AVD Change “Graphics” to “Software”.

How do I run an Android emulator without running the app?

Launch the Android Emulator without first running an app. To start the emulator: Open the AVD Manager. Double-click an AVD, or click Run. The Android Emulator loads. While the emulator is running, you can run Android Studio projects and choose the emulator as the target device.

Why is my Android Studio crashing on my Emulator?

ProTip: Clearing you Android Studio cache could clear huge chunks of data! If your emulator is a device with the Google Play Services enabled, the error might be related to “OpenGL” to fix this, simply: Change “Graphics” to “Software”.

How to fix panic - missing emulator engine program for 'x86' CPU?

If you are getting PANIC: Missing emulator engine program for 'x86' CPU. this error Try starting your emulator from the emulator folder in SDK, like above Example that works for me on OSX / MacOS (replace name of device) Adding a virtual device with the lowest possible Android version that was acceptable in my case worked for me.


1 Answers

I had been messing around with CodeWorks for Android in order to get a working version of Unreal Engine that supports ARCore. I never did get Unreal+ARCore to work, but the emulator in Android Studio had been working fine so I didn't think anything of it.

I noticed that whenever I ran the emulator the ANDROID_HOME and ANDROID_SDK_ROOT would get reset to /Users/{username}/Library/NVPACK/sdk/ and blank respectively. I removed the NVPACK library, and set both ANDROID_HOME and ANDROID_SDK_ROOT to /Users/{username}/Library/Android/sdk/ and now the emulator works as expected again.


Update

I ended up going back to messing with Unreal Engine, and realizing I still needed CodeWorks installed to be able to launch an Android application from Unreal.

So I figured out that Android Studio was getting screwed up because ANDROID_HOME was set to /Users/{username}/Library/NVPACK/sdk/ but in the SDK Manager the SDK location was still set to /Users/{username}/Library/Android/sdk/. I changed this value to /Users/{username}/Library/NVPACK/sdk/ and after re-installing the SDK files, the emulator was up and running fine.

like image 172
Bryan Avatar answered Sep 19 '22 11:09

Bryan