[android] Cannot run emulator in Android Studio

I just got done installing Android studio and trying to take it for a test run. When I try to run my app I get the following error message

emulator: ERROR: This AVD's configuration is missing a kernel file!!
emulator: ERROR: ANDROID_SDK_ROOT is undefined

Does anybody know how to fix this????

This question is related to android android-studio android-emulator

The answer is


Hey there just ran into the same issue you did, the 3rd link down in google brought me to this bit of code that throws the error,

if (kernelFile == NULL) {
        kernelFile = avdInfo_getKernelPath(avd);
        if (kernelFile == NULL) {
            derror( "This AVD's configuration is missing a kernel file!!" );
            const char* sdkRootDir = getenv("ANDROID_SDK_ROOT");
            if (sdkRootDir) {
                derror( "ANDROID_SDK_ROOT is defined (%s) but cannot find kernel file in "
                        "%s" PATH_SEP "system-images" PATH_SEP
                        " sub directories", sdkRootDir, sdkRootDir);
            } else {
                derror( "ANDROID_SDK_ROOT is undefined");
            }
            exit(2);

to which the person wrote:

"/* If the kernel image name ends in "-armv7", then change the cpu * type automatically. This is a poor man's approach to configuration * management, but should allow us to get past building ARMv7 * system images with dex preopt pass"

So I went back in and downloaded the x86 intel atom version for my desired API level and was able to get the emulator up without the error. Hope it helps you too.....


I got it fixed by running "C:\Program Files\Android\android-sdk\AVD Manager.exe" and repairing my broken device.


Just fixed this. Hope this helps others. (Issue as in Android studio v2) This issue is for arm emulators. In this example I am using armeabi-v7a API 16

The fix is three steps:

Step 1: Open sdk manager and make sure that you have installed ARM EABI v7a System Image

Step 2. This is the obvious case of adding the location of sdk to system variables.

Right click on "This PC" icon on desktop, then

Properties -> Advanced system settings -> Environment Variables... Then add the path to sdk as new to system variables section using variable name ANDROID_SDK_ROOT.

Step 3. Restart Android Studio for changes to register. After correcting the ANDROID_SDK_ROOT is undefined issue, the emulator still can't find the kernel files even though it can see that the sdk manager installed it to

path-to-sdk\sdk\system-images\android-16\default\armeabi-v7a\kernel-qemu

The reason is a mix-up between the location the sdk manager installs the kernel file to and the location the emulator is looking for it.

If you open your config.ini (Android Studio -> AVD Mananger -> "Show On Disk") for your emulator you will see the following line:

image.sysdir.1=add-ons\addon-google_apis-google-16\images\armeabi-v7a\

(i.e \path-to-sdk\add-ons\addon-....)

Instead of changing this value in the config.ini file I copied

path-to-sdk\sdk\system-images\android-16\default\armeabi-v7a\kernel-qemu

(kernel file from the folder sdk manager installed)

to

\path-to-sdk\add-ons\addon-google_apis-google-16\images\armeabi-v7a\

And that was the missing kernel file. You can run the emulator. (You will need to close the Android Studio and reopen again) Give the emulator some time as it is 10x times slower compared to x86. (Mine took about 5 minutes to start)


A common approach to follow to solve this problem.

1.CHECK your SDK manager by running from your android studio and stand alons sdk folder by executing ./android.sh helps you to find broken packages

  1. Try installing System emulator images with google API support than the Intel one. Just like , i solved my problem by running into another system image.

  2. Experment on KVM based Virtulaization suggested by Google for Linux


  1. Go to "Edit the System Environment variables".
  2. Click on New Button and enter "ANDROID_SDK_ROOT" in variable name and enter android sdk full path in variable value. Click on ok and close.
  3. Refresh AVD.
  4. This will resolve error.

Normally, the error will occur due to an unsuitable AVD emulator for the type of app you are developing for. For example if you are developing an app for a wearable but you are trying to use a phone emulator to run it.


  • Open Android studio.
  • Go to setting > System Setting > Android SDK
  • Get the "Android SDK Location".
  • Set the environment variable ANDROID_SDK_ROOT to this value.

It worked for me and I'm on Windows 10 and Android studio 2.3.3


I had the same error. The solution for me was change the ANDROID_HOME path. First I took a look into tools->android->sdk manager from Android Studio. In that window, we can see the path where Android Studio looks for the SDK: image

Then I opened a Windows CMD shell, executed:

echo %ANDROID_HOME%

but the path was different to the one in ANDROID STUDIO CONFIGURATION of the first step.

The solution was to change in user environment, the ANDROID_HOME, to the one of the first step: image

I finally closed the cmd shell, and opened another cmd shell to execute:

echo %ANDROID_HOME%

the path was updated, and I could run my emulator perfectly.


It is possible that you really have no system images. Double-check that $ANDROID_HOME/system-images/android-<YOUR DESIRED API>/armeabi-v7a exists and is not empty. If they really are missing - install/reinstall with SDK manager.


In my case (Windows 10) the reason was that I dared to unzip the android sdk into non default folder. When I moved it to the default one c:/Users/[username]/AppData/Local/Android/Sdk and changed the paths in Android Studio and System Variables, it started to work.


Short answer: try to create the same image using the old school <AndroidSDK>\AVD Manager.exe.

Working in Android Studio, running all the integrated tools, it became natural to me not to use the old managers (AVD/SDK).

In my case, I had this problem when used the new (integrated) AVD Manager to create devices with old system images (API 11 and below, as I've tested).

When I tried to use the old school AVD Manager tool (located in <AndroidSDK>\AVD Manager.exe) to create these old device images, I had success.


Go to Tools | Android | AVD Manager

Click the arrow under the Actions column on far right (where error message is)

Choose Edit

Leave the default selection (For me, MNC x86 Android M)

Click Next

Click Finish

It saves your AVD and error is now gone from last column. And emulator works fine now.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to android-studio

A failure occurred while executing com.android.build.gradle.internal.tasks "Failed to install the following Android SDK packages as some licences have not been accepted" error Android Gradle 5.0 Update:Cause: org.jetbrains.plugins.gradle.tooling.util This version of Android Studio cannot open this project, please retry with Android Studio 3.4 or newer WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()' Flutter plugin not installed error;. When running flutter doctor ADB.exe is obsolete and has serious performance problems Android design support library for API 28 (P) not working Flutter command not found How to find the path of Flutter SDK

Examples related to android-emulator

flutter run: No connected devices How to remove the Flutter debug banner? Android Studio AVD - Emulator: Process finished with exit code 1 Android Studio Emulator and "Process finished with exit code 0" Run react-native on android emulator ERROR Android emulator gets killed Error while waiting for device: Time out after 300seconds waiting for emulator to come online Unfortunately Launcher3 has stopped working error in android studio? updating Google play services in Emulator Android Studio emulator does not come with Play Store for API 23