@[toc]

The problem background

I use a relatively new version of SDK, which is integrated into IDEA. My environment variable is to put the AVD device in a special place by configuring ANDROID_AVD_HOME. However, I find that every time THE Emulator starts up Emulator: Emulator: WARNING: IniFile.cpp:235: Failed to open .ini file C:\Users\xxx\.android\emu-update-last-check.ini for writing.

The measures

I reconfigured the environment variables. How do I do that? I just changed the name of the environment variable ANDROID_AVD_HOME to ANDROID_SDK_HOME, and the value of the variable is unchanged. Of course, if you create the emulator through IDEA and start it at this time, there must still be a problem, because we need to restart the computer to make the environment variable take effect. Then open the IDE to create the emulator and start to see that there are no problems

In addition, please delete the device in the direct path of ANDROID_AVD_HOME so as not to occupy too much storage space.

Why to think

Android finds avD device files in the following order:

  • $ANDROID_AVD_HOME
  • $ANDROID_SDK_HOME/.android/avd/
  • $HOME/.android/avd/

Since THE environment variable I used to configure the emulator store path was ANDROID_AVD_HOME, Ini file is stored in $ANDROID_SDK_HOME/. Android, the same directory as avD. So IT occurred to me that if I only configured ANDROID_AVD_HOME that would be equivalent to $ANDROID_SDK_HOME/.android/avd/, There are other important files in $ANDROID_SDK_HOME/. Android that need to be configured as environment variables! So I just changed the name of ANDROID_AVD_HOME to ANDROID_SDK_HOME and kept the same path. After creating the emulator, the.android/avd folder will be created automatically and the device files will be generated in it