• Register
0 votes
4.5k views

Problem :

While running the app on a virtual device (AVD) created on Android studio (in a Windows 10), I am getting below error and panic.

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

I have already defined the ANDROID_SDK_ROOT in my environment variables.

Can anyone please explain me how to resolve above problem?

7 5 2
3,870 points

2 Answers

0 votes

Solution :

You need to define ANDROID_SDK_ROOT as a environment variable where your SDK is residing, the default path would be "C:\Program Files (x86)\Android\android-sdk" and just restart the computer to take effect.

OR

Open your Android Studio and under your Tools you will find a AVD manager. Click on it and ensure that you have the valid virtual device with a SDK downloaded (click on "download" in your Actions column if shown). Then ensure that a correct virtual device is selected on a toolbar.

OR

Go to following path Control Panel>>System and Security>>System>>Advance system settings>>Environment Variables then set the variable value of ANDROID_HOME set it like following "C:\Users\username\AppData\Local\Android\sdk" set the username as your pc name, then just restart your android studio. Then you can create your AVD again after that your error will be gone and it will start the virtual device.

9 7 4
38,600 points
0 votes

Solution:

Identify ANDROID_SDK_ROOT as environment variable where your SDK is located, default path would be "C:\Program Files (x86)\Android\android-sdk" and restart computer to take effect.

Open Android Studio and under the Tools you will trace the AVD manager. Click on it and make sure you have a valid virtual device with the SDK downloaded (click "download" in the Actions column in case shown). 

Then, Go to Control Panel>>System and Security>>System>>Advance system settings>>Environment Variables then place variable value of ANDROID_HOME set it like this "C:\Users\username\AppData\Local\Android\sdk" set username as your pc name, then restart your android studio. afterwards you can make your AVD again than the error will fix than it will begin the virtual device.

For those who are using a Mac:

I had the same problem and the problem was, I made an emulator with API Level 29 however removed that SDK and installed 28 instead. The emulator that was not able to be launched anymore.

Hence inspect the AVD Manager in case your emulator truly can be launched.

Ensure that you have an Android Virtual Device chosen to output the app to. In the picture I set on this post you can see I have chosen the Android Virtual Device "Nexus 5" as the output device. Follwing this removed the error for me.

Attempt to use the argument: -sysdir <Your_SDK_DIR> and then check whether the error message shown.

Check out these clip you will trace out the cause:

// Sanity checks.
if (avdName) {
    if (!isCpuArchSupportedByRanchu(avdArch)) {
        APANIC("CPU Architecture '%s' is not supported by the QEMU2 emulator, (the classic engine is deprecated!)",
               avdArch);
    }
    std::string systemPath = getAvdSystemPath(avdName, sysDir);
    if (systemPath.empty()) {
        const char* env = getenv("ANDROID_SDK_ROOT");
        if (!env || !env[0]) {
            APANIC("Cannot find AVD system path. Please define "
                   "ANDROID_SDK_ROOT\n");
        } else {
            APANIC("Broken AVD system path. Check your ANDROID_SDK_ROOT "
                   "value [%s]!\n",
                   env);
        }
    }
}

Find the ANDROID_HOME path values from environment variable. In my case it is like C:\Users\RuwanPr\AppData\Local\Android\Sdk.
If this value not found please add ANDROID_HOME value as your sdk path.
(To go to environment variable right click on my computer -> Properties -> Advance System Settings -> Environment Variable )
Then open cmd on windows and go to sdk folder and then go to tools folder
Type emulator -list-avds in comd. It will shows avd name list.
Then type emulator -avd avd-name.
Ex - think avd-name shows as J2_Api_22
emulator -avd J2_Api_22

10 6 4
31,120 points

Related questions

0 votes
1 answer 346 views
346 views
Problem : I have very recently updated my Android Studio version and since then I am working on a version 3.1.2. The old device which was configured on the version 2.1 caused following error first after that I tried to configure it on new device with the ... accelerator found. 10:58 Emulator: failed to initialize HAX: Invalid argument Please note my OS is Windows 8. How to resolve above error?
asked Feb 20 mphil 2.3k points
1 vote
1 answer 37 views
37 views
Problem: I have fundamental knowledge about Android. If I try to run my emulator then I always see below error: "Intel HAXM is required to run this avd /dev/KVM is not found. Enable VT-x in your BIOS security setting, ensure that your Linux distro has working KVM ... it referring to Linux distro in my above error message as I am currently running the windows 7 on my HAXM and the VT supported PC?
asked Jun 2 Martin K 6.6k points
0 votes
1 answer 811 views
811 views
Problem : I recently tried to import the sample Android games which I downloaded from Google's developer website. After importing them into my Android Studio, I am getting the below error: Error: SDK location not found. Define location with sdk.dir in the local. ... file or with an ANDROID_HOME environment variable. What is this error means? I want to run my sample programs from a Android Studio.
asked Jan 24 jwilliam 3.9k points