Android Emulator: How to Copy an Emulator / AVD? - android

I am currently making an upgrade of an existing app that's already on the Google App store (aka Google Play). I want to test that the data conversions go smoothly when customers upgrade.
I have an AVD with the old version of the app installed. The usual thing would be to run the new version on this app and see if it works. But the problem is that after doing this, that particular AVD is no longer mimicking that old state.
I'd like to make copies of this AVD/Emulator (yeah, the whole thing!) so that I can make repeated tests.
This seems like something that would happen often, but I can't find any references to this situation. Or am I missing something obvious (I hope!)?

If you want to create a backup of your AVD, then follow the below steps:
To find your avd folder on you machine, check your user directory. For me, with user name “zax”, those locations are:
Windows 7: \users\zax.android
Windows XP: C:\Documents and Settings\zax.android\ on Windows XP
Linux/Mac: ~/.android
Steps for backing up your AVD:
Go to the .android folder and pick the avd you want to export.
Compress the device.avd folder and the device.ini file. (where,
device is the name of the device that you want to backup. Eg.
mmx.avd and mmx.ini)
Copy the compressed files to the new location
These AVD, you can even move across OS, Only thing is you have to change the user name in the device.ini file and so syntax like slash is different for win and linux.
Goto AVD manager> Import > select the backed up .avd > in case x mark is show, repair the device.
Hope this has met your requirements.

Related

Is it safe to delete .android folder in my home folder?

I am trying to free up some space on my hard drive. I've noticed that i have .android folder in my home folder on my mac. Does anyone know is it safe to delete this folder? And what exactly is it? It's 10Gb in size. I did use Android Studio on a school project but I don't use it anymore and I've uninstalled Android Studio since then. I don't have any android devices eighter.
Please don`t delete .android because this folder contain some setting that enable app to be installed and run on android emulator or device.
If you delete this folder, apk installation will be rejected during installation in the android device or emulator.
That is what I experienced after delete this folder.
Normally, it is created when you plug an Android device to your computer, and also it is the default location for the AVD as pointed by Gabriele in the comments. Find some insights in the next links:
https://developer.android.com/studio/run/emulator-commandline#data-filedir
https://askubuntu.com/questions/617912/what-are-the-android-folders-and-adbkey-files-on-my-computer
Cheers!
You can safely delete this folder at any time (except maybe while Android Studio is still running!)
All that will happen is that next time you use Android Studio:
it will need to re-download some stuff.
you might have to uninstall dev builds of apps on your phone and reinstall them again due to a change in keys.
you will lose any data and save states of emulators you were using.

AVD Manager on Android Studio 1.5.1 and install to a custom location emulator won't run

I installed Android Studio (1.5.1 -- see image for build details).
While installing I chose the custom option so I could install a specific path.
I knew that my %SystemDrive% was pointed at a network location and I wanted to install to my local disk.
So, this means that by default, the application would've installed to :
\networkpath\users\myUserName\Android\SDK
However, since I chose the custom installation I chose a local path:
c:\users\myUsername\Android\SDK
Project Creation and Build Work Fine
Everything seemed to install fine and I was able to create a new project and build it with no problems.
However, when I attempted to run the built and then basically failed silently.
The emulator never appeared and no error occurred.
Android Monitor just shows a message stating that No Connected Device detected.
AVD Manager
Luckily I knew a bit about checking to see what happened with the emulator and I opened up AVD Manager.
The listed device displayed an error.
I right-clicked the device and chose "View Details".
That's when the AVD manager showed that it is attempting to read from the network path, even though I changed this in the custom installation.
\networkPath\Users\myUserName\Windows.android\avd\Nexus4.avd
and
\networkPath\Users\myUserName\Windows.android\avd\Nexus4.ini
Registry Edit
I closed Android Studio. Then I opened regedit and edited the values at:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
which originally looked like the following:
And changed them so they all point directly to the c:\ drive (instead of %systemdrive%)
Environment Variable : ANDROID_SDK_HOME
I found that others have mentioned the ANDROID_SDK_HOME environment variable and I noticed that my machine doesn't have that value defined at all so I added it and set it up like the following:
c:\users\myUsername\Android\SDK
I then started Android Studio again and started the AVD Manager.
This time there were no devices show, but instead AVD Manager prompted me to create one with the following window:
Now, I'm attempting to download one of the devices with Google APIs, but each time I do, they download and install successfully, but then disappear from the list. Notice, in the next image there are not API Level 15 or 16 with Google APIs for arm architecture.
Notice additionally that there is one listed for API Level 17 with arm.
I will now attempt to install that one.
You can see that it downloaded successfully and installed fine.
Now, I click the [Finish] button.
The item no longer appears in my list.
The API Level 15 item is chosen automatically. I'm assuming because that one was downloaded originally when I installed Android Studio.
Finally, if you uncheck the [ ] show downloadable system images checkbox -- which is terribly confusing -- and I'm assuming shows you the ones you've already downloaded, then you'll see that it only shows the one API Level 15 virtual device.
This is all quite terrible. Has anyone seen this problem?
Has anyone else been able to fix it?
I'm assuming that I'll just have to go and do a complete re-install of Android Studio.
You should look in the idea.properties file in your project (Android Studio path to different directories). It sounds like this is set to override the system's settings.
EDIT 2 With Final Solution
Thanks to an alert and astute SO post-er (code-apprentice) I was able to get to a solution.
Here's what I had to do.
create idea.properties file and place it at the \networkLocation\myUserName\.Android 1.5\
place the two lines in it which point to my local disk
idea.config.path=C:/Users/myUserName/.AndroidStudio1.5/config/
idea.system.path=C:/Users/myUserName/.AndroidStudio1.5/system/
Then I started Android Studio again and I attempt to install a system image which included the Google APIs.
It worked and it was added to the list:
However, it still did not show the other API LEVELS which I had installed before (15, 16, etc).
Deleted Them From Disk
I noticed that they had been located in a local folder at :
%userprofile%\Android\SDK\add-ons
for whatever reason.
I deleted all of the folders under that path and the original APIs with Google choices appeared in my list again. See highlighted item in image.
SOLUTION
Now when I install them they show up in the list and I can create new AVDs based upon them. Everything works.
EDIT
I used a tool I wrote to watch where Android Studio wrote to disk and I found a path that reveals the problem:
Even though I've made extensive changes to insure the installation would install completely on my local disk, Android Studio saves some (a lot) of data out to this path.
I did a Google on : .AndroidStudio 1.5\config\
That led me to the following documentation:
http://tools.android.com/tech-docs/configuration
There, you will see that the installation should be using %userprofile% to determine where it writes this data. My %userprofile% points to my local disk (c:\users\myUserName) but Android Studio still insists on writing data out to the network.
Here's the important information:
Windows:
%USERPROFILE%\.{FOLDER_NAME}\studio.exe.vmoptions
and/or
%USERPROFILE%\.{FOLDER_NAME}\studio64.exe.vmoptions
%USERPROFILE%\.{FOLDER_NAME}\idea.properties
I deleted the remote .Android Studio 1.5 directory and copied it to my %userprofile% (local) directory. Then I restarted Android Studio and it thinks that it needs to generate all that again because it wants to place it at the remote directory again.
Core issue:
Obviously, it is not using %userprofile%
It gets worse.
I uninstalled the application and all of the settings (supposedly).
Then I installed the entire thing again and it looked as if it were choosing the correct installation path by default:
But, when I started Studio back up then it opened up the project I had created with the first install.
Plus, I still cannot see the API image that I supposedly installed before. Only that one image. Nothing else.
This is really not a great installation system. I'm working on a book which helps beginning Android Devs but if they fall into this problem loop there is no way to get them out of it with a good running emulator.
Very unfortunate.
Download the respective SDK and API levels and Image Systems on Android SDK Manager.
And then they'll show up normally on AVD.

Working with Android Studio & Emulator, C:\ drive is about to die

I'm new in android developing. I use Android Studio 1.2. It's making some large size folders in C:. C:\Users\User\AppData\Local\Temp\AndroidEmulator is about 5 GB. Can I delete or move the file. Or how can I change this path to another drive?
I am answering it based on Android Studio.(v1.5.1), Windows 10.
Most of those temporary files are copies of your app that is installed to your emulator. And some are because of the packages you add to your app using gradle.
Even when your emulator starts it creates a file of more than 1.3GB which disappear when you close the emulator.
About deleting the files. Yes you can delete those files and still able to do every thing you are doing, you can see all installed apps in your emulator and run them for test.
I suppose these are system image downloading.
If you do not need emulator, these files are useless to you. You can remove them through SDK Manager.
If these files remain in Temp, just delete them
By the way,to move your temp folder : http://www.wikihow.com/Change-Location-of-the-Temp-Folder-in-Windows-7
In Custom Installation option, you will have option to place Studio and AVD manger on other Locations whichever you prefer.

How to get Android Studio 1.1.0 to not use default folders and pay attention to env. variable?

Specifically, on Windows 7 Pro SP1, it uses C:/Users/Alan/{.android,.AndroidStudio,.gradle}. I want it to use S:/Android/{SDK_Home,SDK_Root}/{.android,.AndroidStudio,.gradle}.
I have tried setting environment variables: ANDROID_SDK_HOME = S:\Android\SDK_Home and ANDROID_SDK_ROOT = S:\Android\SDK_Root. But it makes no difference. This persists after uninstalling Studio 1.0 and all files and folders and creating blank ones appropriately and installing and re-installing Studio 1.1.0.
The install does use the Home and Root folders to store about 3 GB of files (as I made a setting in the Install process), but it still puts an additional about 300 MB in the User directory and it doesn't put .gradle on the S drive as I would like. The User directories continue to grow as Android is used. It seems to not use C:\Users\Alan\AppData\Local anymore (thank goodness for small favors). I can't have any space taken on the C drive as it is already too full, especially if AS is growing the space it uses.
Robert suggests running a bat file to start the Studio, but it is not clear how to start the studio from a shell. I did see instructions on the Android developer site for starting an app from a shell, but not the studio. Running tools/android.bat starts the SDK Manager but not Studio. He says to set the environment variables in some bat file but they are already set in the operating system.
In any case, that doesn't solve the problem of Android Studio ignoring the settings it asks of the user during installation and ending up eating space in the C drive when the user has explicitly asked for this to not happen.
I've tried searching with terms like "move .AndroidStudio folder" and "Android Studio environment variables", but it seems to almost all be talking about the Java variable (which works fine).
Since I'm just starting an Android project I don't mind wiping and re-installing as needed.
This a year later, and thus for a different version of studio (2.2), but here's the answer. Below, the new user and/or config folder will have a full path of C:\new.
1) Copy the idea.properties file (which can be found either in the .AndroidStudio folder or in studio's /bin) to C:\new\idea.properties. Next, set the STUDIO_PROPERTIES environment variable to that location (STUDIO_PROPERTIES = C:\new\idea.properties).
2) Repeat step one for studio.exe.vmoptions or studio64.exe.vmoptions (probably the second one if you're developing in 64-bit), this time setting an environment variable called STUDIO_VM_OPTIONS to that file's location.
3) Open your new copy of idea.properties and set idea.config.path and idea.system.path to C:/new/config and C:/new/system respectively (there should be a template for both near the top that's commented out -- also note the forward slashes).
4) Set ANDROID_SDK_HOME and GRADLE_USER_HOME to C:\new
5) Set ANDROID_SDK_ROOT to the root of your sdk installation, if that's non-standard.
Note that a .AndroidStudio2.2\system folder still gets created in your user folder, but it does not seem to be used.
This answer was compiled by combining this blog post with this page from the Android Studio docs.

eclipse won't create adt project due to 'access denied'

I installed JavaEE, JDK, Eclipse 3.5.x (Galileo), the Android Starter SDK, and the current ADT all with no problems. However, when I try to walk through the 'Hello Android' tutorial, I bring up the New Android Project wizard, fill it in and hit 'Finish'.
After a moment, it comes back with a message saying there was a problem at path X:\so and so\ (access denied).
Things to note:
-Running Windows 7 Home Premium 64-bit
-Quadcore Pentium with 8GB RAM, 8TB NAS
-I am an Administrator
-I have also tried this by activating the full (hidden) Administrator profile
-I have reinstalled everything 8 or 9 times
-I have changed ownership & permissions all over the place
-I have launched eclipse in 'Run as Administrator' Mode
-I have installed Everything as 32-bit, as others have done this successfully
Eclipse creates the folder it's having a problem with, but then cannot work with the .project file it creates (access denied). It then can't save anything so there is nothing but an empty folder 'Hello_Android' on the left within Eclipse.
Anybody have any clues about what is going on-- I'm frustrated. I want to get into this, and I've looked EVERYWHERE on the net trying to crack this nut.... but I need help.
-J
Hmmm. Interesting.
I would double-check permissions on the folder X:\so and so\ and ensure that the Administrators group and/or your account has full control.
Have you tried creating the project outside of the users or systems environment? You know in c:\myprojects
Windows7 and creating/saving files in program files or documents can be a PITA.
Turned out to be a bug with how eclipse is written. I've developed a workaround.
The problem is that eclipse can't write to hidden files, unhide them and it should work.

Categories

Resources