I want to change .android folder [duplicate] - android

After installation of Android SDK, the folder .android was created on the E:\ drive. As far as I know, this is the default folder of Android Virtual Devices for configuration files.
How can I move .android folder to a different location?
(eg. from E:\.android to E:\Android\.android)

I've found the answer.
Move .android folder to E:\Android
Create environment variable called
ANDROID_SDK_HOME and set its value to
E:\Android
Setting the environment variable on Windows XP or Windows 7:
Right-click on My Computer and choose "Properties"
Click the "Advanced" tab
Click the button "Environment Variables".
Add New variable

By default, the emulator stores configuration files under $HOME/.android/ and AVD data under $HOME/.android/avd/. You can override the defaults by setting the following environment variables.
The emulator searches the avd directory in the order of the values in $ANDROID_AVD_HOME, $ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/.
This page provides the list of environmental variables supported by android studio: https://developer.android.com/studio/command-line/variables

The path set in ANDROID_SDK_HOME must exist. Otherwise the default path will be chosen.
But it is not necessary to include .android. The AVD Manager creates a .android folder, if not found in ANDROID_SDK_HOME.

If you go for this answer be aware of this note:
Starting with Android Studio 4.2, the ANDROID_SDK_HOME environment variable is deprecated and has been replaced with ANDROID_PREFS_ROOT.

In addition to the answer provided by Dariusz Bacinski, you have to include the .android folder in the ANDROID_SDK_HOME path. It was not working for me if I did not include the .android folder.

If you want to move just the AVD folder and not everything else, use those environmental variables.
ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is
$ANDROID_SDK_HOME/.android/.
ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large disk images. The default location is $ANDROID_EMULATOR_HOME/avd/. You might want to specify a new location if the default location is low on disk space.

If you would like your avd sdcard and files on a different drive, go to $HOME/.android/avd and move the folder <AVD_NAME>.avd to someplace else
Edit $HOME/.android/avd/<AVD_NAME>.ini and change
path=<NEW_AVD_LOCATION>/<AVD_NAME>.avd
$HOME depends on your system. On windows it can be your user directory

(Optional) Download Rapid Environment Editor
Add a new system variable
ANDROID_PREFS_ROOT = D:\IDE\Externals\ANDROID_PREFS_ROOT (The folder you want to move to.)
Save and you're done.

Related

How to resolve this name issue having white space while installing the android Studio.?

SDK location should not contain whitespace, as this can cause problems with the NDK tools.
It says that the path name should not contain any white spaces. But i cant rename it.
There is no any rename option for that folder when right clicked.
When i change the folder to which there is not any space, it says that "Target Folder is neither empty nor does it point to an existing SDK Installation."
A good candidate for your Android SDK parent is the ProgramData folder.
Move the SDK out of the C:\Users\CHARAN KUMAR folder and into a folder in the C:\ drive that doesn't have any whitespace (perhaps C:\Android\SDK\ or something similar).
Using an administrator account on Windows create either a symbolic link or a junction to the user's directory.
Symbolic link: mklink /d CHARANKUMAR "CHARAN_KUMAR
Junction: mklink /j CHARANKUMAR "CHARAN_KUMAR
Now you can use the C:\CHARANKUMAR\AppData\Local\Android\Sdk directory.

android emulator can't start because .android folder deleted from the system [duplicate]

I'm brand new to Android development and Eclipse so I have just set it all up and I am attempting the Hello World tutorial. Sadly when I try and run the program I get the following error:
PANIC: Could not open: C:\Users\Nathan Smith.android/avd/Droid_4.0.3.ini
I have heard that you should avoid spaces in these paths. Is the space in the name where the problem is? If so how do I go about changing it?
If anyone could help me out with this that would be grand.
By the way I also noticed that my SDK path is C:\Users\Asus Laptop\android-sdks\ should I change this to the same user? This was not intentional, is there an easy way of me changing this to the right user?
This has been asked a few times already, try this:
Create a environment variable called: ANDROID_SDK_HOME and set it to
C:\Users\Administrator
Open Eclipse > Window > Preferences and click
in Run/Debug and String Substitution
Add a new variable called:
user.home and set it to C:\Users\Administrator
Create an AVD and run
it.
Android Emulator can't start, 'cause of wrong folder
android emulator error:[2011-08-02 11:14:01 - Emulator] PANIC: Could not open: C:\Users\hallo\.android/avd/myemu.ini
I have problem in a emulator
A simple solution,
Create your avd with normal steps. e.g. avd name is Nexus_One. You will see Nexus_One folder and Nexus_One.ini file at D:\Users\Nathan Smith\.android\avd
Copy Nexus_One.ini to C:\Users\Nathan Smith\.android\avd
Try running avd through AVD Manager. It will start the emulator.
Reason being it works, if you read ini file, you will find path variable as below,
path=D:\Users\Nathan Smith\.android\avd\Nexus_One.avd
path.rel=avd\Nexus_One.avd
So, when you start emulator, it check the ini and tries to start emulator from path mentioned in path variable.
Hope this solves your problem.
Find the .android folder on your cpu. You can find it by going to Window -> Preferences -> Android -> Build, and see the "Default debug keystore:" path location.
After you find it, move the .android folder to your user root directory
- which may be "C:\Users\Nathan Smith\" in your case.
I had the same problem, but now its fixed.
Go to Windows in Eclipse, Windows->preference->run/debug->stringSubstitution-> add variable name as "user.home" Then the value will be your profile path
Example: mine is C:\users\sriramk\.android
Now open the default .android path, copy the content, and paste that content into
C:\users\sriramk\.android. Restart Eclipse and now the emulator will open.
The simple solution is to create a symbolic link between your home directory and destination .android directory. The problem is that emulator looks for files on in your home directory.
mklink /D Link Target
Probably you can copy .android dir or change a setting.
The AVD manager normally uses the user's profile directory to store AVD files.
However it failed to find the default profile directory.
To fix this, please set the environment variable ANDROID_SDK_HOME to a valid path such as "".
Step 1. (Windows 7 Only... 64-bit version Tested) Go to your start menu, then open the Control Panel.Click System and Security, click System, then open up the Advanced System Settings (on the left). Go to the Advanced Tab, then click Environment Variables.Check your user variables.
If you don't, find A variable named ANDROID_SDK_HOME with the Value, click new. In the Variable Name box, type in "ANDROID_SDK_HOME" (Without quotes).
In the Variable Value, type in something like c:/Users/jorge/AppData/Local/Android/Android-sdk. Click OK.Then click OK. Click OK again. Close the Control Panel and restart your computer.
Try Running SDK or AVD Manager(s) again. Create an AVD and run it.
Home Folder Redirection To UNC / AVD Shows UNC Path
If you're unfortunate to have network UNC path mapped as your home directory using Windows Folder Redirection then AVD will fail to start.
You should also have a normal user directory under C:\Users, which contains non-mapped stuff. The trick is for Android SDK to use this instead. Similar to other answers, you need to set ANDROID_SDK_HOME user environment variable to your C:\ based home directory.
For example:
ANDROID_SDK_HOME = C:\Users\MyUserName
Restart Eclipse.
In my hunt for a resolution, I found this answer which gives a great performance increase: https://stackoverflow.com/a/19338671/1554386
I had the same problem, the issue seemed to be low disk space on the drive containing the emulator files (C).

Android/Eclipse PANIC: Could not open

I'm brand new to Android development and Eclipse so I have just set it all up and I am attempting the Hello World tutorial. Sadly when I try and run the program I get the following error:
PANIC: Could not open: C:\Users\Nathan Smith.android/avd/Droid_4.0.3.ini
I have heard that you should avoid spaces in these paths. Is the space in the name where the problem is? If so how do I go about changing it?
If anyone could help me out with this that would be grand.
By the way I also noticed that my SDK path is C:\Users\Asus Laptop\android-sdks\ should I change this to the same user? This was not intentional, is there an easy way of me changing this to the right user?
This has been asked a few times already, try this:
Create a environment variable called: ANDROID_SDK_HOME and set it to
C:\Users\Administrator
Open Eclipse > Window > Preferences and click
in Run/Debug and String Substitution
Add a new variable called:
user.home and set it to C:\Users\Administrator
Create an AVD and run
it.
Android Emulator can't start, 'cause of wrong folder
android emulator error:[2011-08-02 11:14:01 - Emulator] PANIC: Could not open: C:\Users\hallo\.android/avd/myemu.ini
I have problem in a emulator
A simple solution,
Create your avd with normal steps. e.g. avd name is Nexus_One. You will see Nexus_One folder and Nexus_One.ini file at D:\Users\Nathan Smith\.android\avd
Copy Nexus_One.ini to C:\Users\Nathan Smith\.android\avd
Try running avd through AVD Manager. It will start the emulator.
Reason being it works, if you read ini file, you will find path variable as below,
path=D:\Users\Nathan Smith\.android\avd\Nexus_One.avd
path.rel=avd\Nexus_One.avd
So, when you start emulator, it check the ini and tries to start emulator from path mentioned in path variable.
Hope this solves your problem.
Find the .android folder on your cpu. You can find it by going to Window -> Preferences -> Android -> Build, and see the "Default debug keystore:" path location.
After you find it, move the .android folder to your user root directory
- which may be "C:\Users\Nathan Smith\" in your case.
I had the same problem, but now its fixed.
Go to Windows in Eclipse, Windows->preference->run/debug->stringSubstitution-> add variable name as "user.home" Then the value will be your profile path
Example: mine is C:\users\sriramk\.android
Now open the default .android path, copy the content, and paste that content into
C:\users\sriramk\.android. Restart Eclipse and now the emulator will open.
The simple solution is to create a symbolic link between your home directory and destination .android directory. The problem is that emulator looks for files on in your home directory.
mklink /D Link Target
Probably you can copy .android dir or change a setting.
The AVD manager normally uses the user's profile directory to store AVD files.
However it failed to find the default profile directory.
To fix this, please set the environment variable ANDROID_SDK_HOME to a valid path such as "".
Step 1. (Windows 7 Only... 64-bit version Tested) Go to your start menu, then open the Control Panel.Click System and Security, click System, then open up the Advanced System Settings (on the left). Go to the Advanced Tab, then click Environment Variables.Check your user variables.
If you don't, find A variable named ANDROID_SDK_HOME with the Value, click new. In the Variable Name box, type in "ANDROID_SDK_HOME" (Without quotes).
In the Variable Value, type in something like c:/Users/jorge/AppData/Local/Android/Android-sdk. Click OK.Then click OK. Click OK again. Close the Control Panel and restart your computer.
Try Running SDK or AVD Manager(s) again. Create an AVD and run it.
Home Folder Redirection To UNC / AVD Shows UNC Path
If you're unfortunate to have network UNC path mapped as your home directory using Windows Folder Redirection then AVD will fail to start.
You should also have a normal user directory under C:\Users, which contains non-mapped stuff. The trick is for Android SDK to use this instead. Similar to other answers, you need to set ANDROID_SDK_HOME user environment variable to your C:\ based home directory.
For example:
ANDROID_SDK_HOME = C:\Users\MyUserName
Restart Eclipse.
In my hunt for a resolution, I found this answer which gives a great performance increase: https://stackoverflow.com/a/19338671/1554386
I had the same problem, the issue seemed to be low disk space on the drive containing the emulator files (C).

How do I change the default location of an Android AVD? [duplicate]

I've set up the Android SDK and Eclipse on my machine running Windows XP and AVDs (Android Virtual Devices) are saved to "Documents and Settings\user\.android" by default. Is there any way to change this behavior? I have all of the other components saved in a directory on a separate partition and would like everything to be consolidated. Obviously not a huge deal but does anyone here know a workaround for this?
Add a new user environment variable (Windows 7):
Start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable (at the top) that points your home user directory:
Variable name: ANDROID_SDK_HOME Variable value:
a path to a directory of your choice
AVD Manager will use this directory to save its .android directory into it.
For those who may be interested, I blogged about my first foray into Android development...
Android "Hello World": a Tale of Woe
Alternatively, you can use the Rapid Environment Editor to set the environment variables.
Based on official documentation https://developer.android.com/studio/command-line/variables.html you should change ANDROID_AVD_HOME environment var:
Emulator Environment Variables
By default, the emulator stores configuration files under
$HOME/.android/ and AVD data under $HOME/.android/avd/. You can
override the defaults by setting the following environment variables.
The emulator -avd command searches the avd directory in the
order of the values in $ANDROID_AVD_HOME,
$ANDROID_SDK_HOME/.android/avd/, and $HOME/.android/avd/. For emulator
environment variable help, type emulator -help-environment at the
command line. For information about emulator command-line options, see
Control the Emulator from the Command Line.
ANDROID_EMULATOR_HOME: Sets the path to the user-specific emulator configuration directory. The default location is
$ANDROID_SDK_HOME/.android/.
ANDROID_AVD_HOME: Sets the path to the directory that contains all AVD-specific files, which mostly consist of very large
disk images. The default location is $ANDROID_EMULATOR_HOME/avd/.
You might want to specify a new location if the default location is
low on disk space.
After change or set ANDROID_AVD_HOME you will have to move all content inside ~user/.android/avd/ to your new location and change path into ini file of each emulator, just replace it with your new path
Modify the file "virtual_android2.2.ini" in "C:\Documents and Settings{your windows login}.android\avd\":
target=android-8
path=E:\android_workspace\avd\virtual_android2.2.avd
And move the folder "virtual_android2.2.avd" from "C:\Documents and Settings{your windows login}.android\avd\" into "E:\android_workspace\avd\".
Move your .android to wherever you want it to.
Then, create a symlink like this:
# In your home folder
$ ln -s /path/to/.android/ .
This simply tells Linux that whenever the path ~/.android is referenced by any application, link it to /path/to/.android.
Go to the Android tools directory. Edit the android.bat command file. At about the end of the command file, find a line similar to
call %java_exe% -Djava.ext.dirs=%java_ext_dirs% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir="%work_dir%" -jar %jar_path% %*
and replace
call %java_exe%
with
call %java_exe% -Duser.home={your_prefer_dir}
where {your_prefer_dire} is your preferred directory without braces but add doublequotes,
e.g.
call %java_exe% -Duser.home="E:\Program Files (x86)\android-sdk-windows"
For Visual Studio 2017 on Windows 10
Copy C:\Users\YOURUSERNAME\.android folder to (for example) E:\avd
Open the environment variables window:
Go into Settings and click on System.
On the left, click About and select System info at the
bottom.
In the new window, click Advanced system
settings on the left.
Click Environment Variables at
the bottom of the resulting window.
Add a new variable:
Variable name: ANDROID_SDK_HOME
Variable value: a path to a directory (e.g E:\avd)
Don't include .android in the variable value.
Restart Visual Studio.
For change SDK & NDK location go to:
Tools -> Options -> Xamarin -> Android Setting
You can change the .ini file for the new AVD:
target=android-7
path=C:\Users\username\.android\avd\VIRTUAL_DEVICE_NAME.avd
I don't know how to specify where the .ini file should be stored :)
In Windows 10 I had that problem because My C Drive was getting full and I had needed free Space, AVD folder had 14 gig space so I needed to move that folder to another driver, first answer not work for Me so I tested another way to fix it this problem,
I make a picture for you if you have the same problem, you don't need to move all of the files in .android folder to another drive (this way not work) just move avd folders in ....android\avd to another drive and open .ini files and change avd folder path from that file to the new path.
Like this image:
I hope this works for you.
Note: careful about a separate character before and after the path in ini file that you cannot see,if you remove that character it's not works
Check this out.
using the android command to create avd you can specify where to place files.
-p --path Location path of the directory where the new AVD will be created
The environmental variable ANDROID_AVD_HOME can be used to define the directory in which the AVD Manager shall look for AVD INI files and can therefore be used to change the location of the virtual devices;
The default value is %USERPROFILE%\.android\avd on Windows (or ~/.android/avd on Linux).
One can also create a link for the whole directory %USERPROFILE%\.android on Windows (or a sym-link for directory ~/.android on Linux).
When moving AVDs, the path entry in AVD INI file needs to be updated accordingly.
Another way to specify ANDROID_SDK_HOME without messing around with environment variables (especially when using ec2) is simply create a shortcut of eclipse and add the following as target
C:\Windows\System32\cmd.exe /C "setx ANDROID_SDK_HOME YOUR AVD PATH /M & YOUR ECLIPSE.EXE PATH"
This will set ANDROID_SDK_HOME as system variable whenever you launch eclipse.
HTH
Paul
Please take note of the following : modifying android.bat in the Android tools directory, as suggested in a previous answer, may lead to problems.
If you do so, in order to legitimately have your .android directory located to a non-default location then there may be an inconsistency between the AVDs listed by Android Studio (using "Tools > Android > AVD Manager") and the AVDs listed by sdk command line tool "android avd".
I suppose that Android Studio, with its internal AVD Manager, does not use the android.bat modified path ; it relies on the ANDROID_SDK_HOME variable to locate AVDs.
My own tests have shown that Android tools correctly use the ANDROID_SDK_HOME variable.
Therefore, there is no point, as far as I know, in modifying android.bat, and using the environment variable should be preferred.
there are major 4 steps
1. copy the .android folder to your desired location as i did in D:\Android\.android
2. set ANDROID_AVD_HOME in environment variables like ANDROID_AVD_HOME D:\Android\.android\avd
3. change avd name.ini file contents with new location like
avd.ini.encoding=UTF-8
path=D:\Android\.android\avd\Pixel_2_API_29.avd
path.rel=avd\Pixel_2_API_29.avd
target=android-29
4. restart android studio
1 - Move AVD to new Folder
2 - start Menu > Control Panel > System > Advanced System Settings (on the left) > Environment Variables
Add a new user variable:
Variable name: ANDROID_AVD_HOME
Variable value: a path to a directory of your choice
3 - Change the file .INI Set new folder.
4 - Open Android Studio
WORKS - Windows 2010
MORE INSTRUCTIONS : https://developer.android.com/studio/command-line/variables
In my case, what I concerned about is the C: drive disk space.
So what I did is copy the ".avd" folder(not file) to other drive, and leave the ".ini" file there but change it to point to the moved
I think the easiest way is to move the avd folder from C:\Users[USER].android folder to your desired location then create a symbolic link to it in C:\Users[USER].android with the same name.
If you wonder how to do this, first install Link Shell Extension. After folder movement right click on it and select Pick Link Source then right click in .android folder and in Drop As... sub menu select Symbolic Link.
I followed https://www.mysysadmintips.com/windows/clients/761-move-android-studio-avd-folder-to-a-new-location.
Start copying a folder "C:\Users\user\.android\avd" to "D:\Android\.android\avd" (or something else).
Close Android Studio and running emulators.
Press Win + Break and open Advanced System Settings. Then press Environment Variables. Add a user variable ANDROID_SDK_HOME. (I didn't experiment with ANDROID_AVD_HOME.) In Variable value field write D:\Android. If you also moved SDK to another folder, change ANDROID_HOME (I forgot to change it and some emulators didn't launch, see https://stackoverflow.com/a/57408085/2914140).
Wait until the folder will finish copying and start Android Studio.
Open Android Virtual Device Manager and see a list of emulators. If you don't see emulators and they existed, then probably you entered wrong path into user variable value in step 3. In this case close AS, change the variable and open AS again.
Start any emulator. It will try to restore it's state, but it sometimes fails. A black screen can appear instead of Android wallpaper.
In this case you can:
a. Restart your emulator. To do this close running emulator, then in AVD Manager click Cold Boot Now.
b. If this didn't help, open emulator settings, found in file "D:\Android\.android\avd\Pixel_API_27.ini".
Change a path to a new AVD folder. Restart the emulator.
Delete old AVD folder from "C:\Users\user\.android\avd".
For Windows 10 :
ANDROID_SDK_HOME
this link helped me.
Then just moved all content of "avd" to the new location. Now you may need to change the value of "path=" in the configuration Setting file of each avds to the new location. You can see the old avds in avd manager in Android Studio and they work.
ANDROID_SDK_HOME also worked for me on Windows 8 x64
also find all location (in my case it was d:\.android) and delete it. You won't need it anymore.
In AVD manager, after setting up AVD using a target with Google APIs, on run was getting error.
Detail showed: "AVD Unknown target 'Google Inc.:Google APIs:...... "
During install (on Win7 system) I had chosen a SDK directory location, instead of accepting C:\Users\...
I'd then added that directory to environment variable 'path'
Command line: android list targets did show a couple of Google apis.
Setting ANDROID_SDK_HOME to my install path fixed the avd run error.
Variable name: ANDROID_SDK_HOME
Variable value: C:\Users>User Name
worked for me.
MacOs
Get a directory adv
./emulator -help-datadir
the default directory is:
/Users/{your_computer_user_name}/.android
and then Go to avd Folder edit .ini file with path to your custom emulator directory
example :
path=/Volumes/Macintos/_emulatorandroid/avd/Nexus_5X_API_27.avd
path.rel=avd/Nexus_5X_API_27.avd
target=android-27
and then save. Now your Emulator haschange
And Result:

Android SDK and AVD Manager -Cant create AVD in correct file location

When trying to create an AVD with the android SDK AVD manager I get 'Error: null'. This keeps happening because the SDK manager is looking for 'List of existing Android Virtual Devices located at \...(wrong location).
How can I change the file location?
I had similar issue. I have solved this by setting up the environment variable ANDROID_SDK_HOME in my startup script. The path shall be your desired location of .android folder, excluding the last slash. Example:
SET ANDROID_SDK_HOME=C:\Users\toybuilder\Downloads
I had the same problem this weekend. In my case, I was able to create the AVD's, but not able to start them.
The problem was caused by the AVD Manager creating the AVD's in a different directory from where the emulator was trying to launch the AVD's.
In my case, AVD Manager was initially reporting the list of existing Android Virtual Device located at C:\Users\toybuilder\Downloads\.android\avd
It turns out that my Java runtime (in this case, JDK 1.6u24) was reporting C:\Users\toybuilder\Downloads as my home directory (user.home property). I first confirmed this via Eclipse:
In Eclipse, go to:
Eclipse Menu: Help -> About Eclipse
Click on the [Installation Details]
Click on the [Configuration] tab:
The text box fills with an extended dump of the Eclipse environment .
Look for the user.home value. In my case, the line read:
user.home=C:\Users\toybuilder\Downloads
It turns out that there's a long-standing Java bug (nearly 9 years old) on how the Java runtime determine's the user.home property - as discussed elsewhere on StackOverflow
In my particular case, the buggy behavior was triggered by a bad windows folders redirection. I had apparently moved my Desktop folder into my Downloads directory at some point by accident. Although I had fixed the problem, it nevertheless left an entry in my registry with a Desktop folder redirection to the Downloads directory. There was a HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop registry key that pointed, incorrectly, to C:\Users\toybuilder\Downloads\Desktop
The Java runtime was apparently setting user.home as "Desktop"/.. (i.e., the Downloads directory), while some other mechanisms were resolving the home directory at the correct location (probably the Windows %userprofile% environmental value) -- and hence when the emulator was starting up, it could not find the .android/avd directory, because it was looking from a different starting directory.
After I deleted the incorrect redirection registry key, the problem went away.
Windows with "folder redirection" have this issue. If you are logged in a domain and the admin has set a redirection for your home folders eclipse/android SDK cannot read correctly some files. You can try the following steps:
Close Eclipse
Just set a user environmental variable like:
Variable Name:ANDROID_SDK_HOME
Variable Value:C:\Users\{your login}
Copy the .android folder from the "redirection" folder to C:\Users\{your login}
Start Eclipse.
Now the AVDs should work fine.
I have a Solution for this error:
Right click Folder "C:\User\yournamecomputer.android" and uncheck Read-Only
it work for me :D
SET ANDROID_SDK_HOME variable not working for me.
Open eclipse
Click on window menu and then select preference.
Select android from left hand side.
Now SET SDK location e.g. E:\android\sdk instead of ../sdk means set Absolute path instead of Relative path.
Its worked for me.
I hope this help someone and save time.

Categories

Resources