I’m starting to learn Ionic and after a few hours of installing/updating software I went down the short list of commands to see an app on my device. The final command to start an Android emulator, which is:
Produced this error:
PANIC: Cannot find
AVD system path. Please define ANDROID_SDK_ROOT
Given the error message we of course need to create a new environment variable but instead of creating “ANDROID_SDK_Root” you instead create one called “ANDROID_AVD_HOME”. Along with creating that new variable we will also need to determine the “AVD system path”.
You will be interested to know that Android searches for the AVD path via three different environment variables in a specific order. The variable names and order of precedence are:
As you can see, “ANDROID_AVD_HOME” trumps the other paths for specifying where your AVD’s can be found.
Creating environment variables in Windows is well documented everywhere you look, but here’s the short list of steps:
- Right-click “My Computer”
- Click on “Properties”
- Click “Advanced System Settings”
- Click “Environment Variables”
- Under “System Variables” click “New”
- For the variable name follow the console output and use “ANDROID_AVD_HOME”
- For the variable value….. see below
Locating the path to your AVD’s can easily be found by firing up the Android Virtual Device Manager which is located in your Android SDK directory. The path to my Android installation was the following:
Yours may be similar to the above, or use Cortana to locate it for you.
Again, locate and start the Android Virtual Device Manager. In this screen shot I’ve created a single AVD:
Click an AVD to select it then click on the “Details” button. You will see the following:
Note the path to your AVD directory, that is your AVD System Path. Use the path up to the “avd” directory as the value for the variable value as can be seen below:
[EDIT] the trailing slash in your paths is important!!! its not in the screen cap, but you must have a trailing slash!!!!
All done. Restart your console and give it a try.