Unabel to reboot emulator from within Android Studio, says - linux

I am trying to reboot a virtual device, which is currently running. If I choose Cold Boot Now
it swears "AVD .... is already running", which is true.
How to reboot then?

By pressing "X" icon of the emulator tab, you can terminate your emulator.
Alternatively, you can "emulate" reboot by long pressing "Power" icon in the emulator menu (1st icon)

Related

Android Emulator got stuck at "shutting down"

The emulator in my android studio keeps showing "shutting down". I try closing it and run again, restarting my mac, but nothing worked, each time I run it, it shows "shutting down" again. even though I can see actions running below (very blur)
Click on Tools
Click on AVD Manager
Click on the dropdown arrow next to the AVD which is stuck
Click on cold boot now
This issue occurs when we forcibly exit an unresponsive/stuck AVD. AVD manager saves the state before it is forcibly exited and on the next start it continues from the unresponsive/stuck state. This is useful when we need the AVD to boot up quickly, however if you want to disable this feature entirely then follow the steps below:
In the AVD manager, click on the pencil icon
A new window will pop up. Click on show advanced settings
Scroll down to the emulated performance section
Next to boot option, select cold boot
open AVD Manager Dialog from top right corner
go to your emulator
click on the last icon on the right which is a drop down button
Click wipe data
Important Note: this will delete all data on that emulator and give it a fresh install again and might solve your problem
If that didn't work then check that you have enough rams to run both the emulator and the android studio.
I run my emulator with cold boot by command line
cd C:\Users\<your_user_name>\AppData\Local\Android\Sdk\emulator
emulator -list-avds
emulator -avd <your_adb_name> -no-snapshot-load
If the cold boot or wipe data does not work, you can try deleting the lock file. Then quit the emulator, and restart it.
In my case, AVD Manager prompted me to delete the following files, I did it, and the problem was solved.
If it shows "AVD *** is already running etc." then just connect any mobile device that after enabling debugging mode and run your app in a physical device instead of an emulator then
Click on Tools
Click on AVD Manager
Click on the dropdown arrow next to the AVD which is stuck
Click on cold boot now
First of all:
You have to close the window, or tab of your Virtual Appliance.
With this you get Android Studio to standby the Device and unlock the ADV (Android Virtual Device) files, so you can manipulate the virtualization.
Maybe you have to wait until Android Studio kill the process. If Android doesn't do this automatic, you will have to close Android Studio and delete C:\Users{YOUR_USER}.android\avd{YOUR_DEVICE_NAME}.avd and within this folder delete all files and folders with extension .lock to stay secure before start again Android Studio.
After that:
Just open the Device Manager, and click on the down arrow in the Actions section for your device, and select Cold Boot Now. This reload the Virtual Device without start or open any program.
Finally:
If Cold Boot Now worked fine, now you can run or debug your application to check that it functions perfectly. Without the device continuing with the problem that the system is still stuck/frozen.
And also you do not need to do a Wipe Data, so you do not delete the data of your application, since you can have any internal database in SQLite, which has the changes and advances that you have been implementing or creating during the development of your application for its operation.

Debugging in Android Studio doesn't work because INSTALL_FAILED_DEXOPT

After connecting a real device and debugging the virtual device stopped working.
So I deleted the virtual device and create a new one.
But now when I click either Run or Debug it comes up with this warning
so I click "OK" and then nothing happens but this appears:
06/05 11:18:19: Launching 'app' on Nexus 7 API 22.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_DEXOPT
The device might have stale dexed jars that don't match the current version (dexopt error).
Retry
Can I ever debug on a virtual device ever again? How?
This looks like an issue of reading the latest emulator state or something similar.
I've been able to fix that by wiping data from a selected emulator and cold booting it.
Open AVD Manager by clicking on it's icon:
or by double-clicking Shift key, typing in AVD Manager and clicking on desired option:
From a list of emulators you have find the one that is causing you trouble. On the end right side find arrow pointing down. Click on it and select Wipe Data:
Click the same arrow and click Cold Boot Now.
From now on your emulator should work fine.

How to prevent Android Studio 2.0 from running on same device

With the new update of Android Studio, whenever I rebuild my app, it always launches it on the same emulator/device. In order for me to switch devices, I have to shutdown the emulator/disconnect the device, so that it brings up the device selection screen.
Is there any way around this?
For me I had to press the red stop button in order to stop the "instant run" mode which automatically runs your app on the same device.
Once I press the stop button I can run the app again and it will bring up the device chooser dialog.
Just do this:
Select this menu:
And then uncheck the "Use the same device.." option:
Uncheck thi option:

Android Studio 2.0 launch APK on another device

Since Android Studio 2.0 and its reworked "build / run" mechanism, I can't "launch" an APK on a second device anymore. Once the APK has been loaded on the first device, I can't choose to launch a build to another device.
"Run" will target the current device
"Re-run" will stop the application running on the current device and upload it to the "second" device.
So my question is : "How can I launch a "second" build targeting a different device than the first device I builded on without terminating the first process ?"
Sorry for my bad english, this is not my native language.
If you click the stop button (Red Square), the Instant Run is deactivated. Then click the Run button the list of devices appears again.
The drawback is that when you click on the stop button the application is killed on the current running device.
We need a way or a shortcut to bypass Instant Run
Disconnect the device, click on the "play" button. Android Studio ask you now where to run the app.
Connect your device and select it.
On of the helpful method I found through which at-least you don't have to disconnect your already connected device to run the app on another device.
Click on the arrow down icon near to run option and select Edit Configuration.
It will open Run/Debug configuration dialog box, uncheck the checkbox "Use same device for future launches".
Next time when you will hit the run button, Android Studio will ask you to select the device.
When you deploy to your first device, make sure you have not selected to launch on the same device for future launches. Untick in your case.
Should you have already had this option on, and it is running on the same device, then unplug the device it is launching on, or turn off the emulator.. and it will ask you which device you now want to launch on.

Windows Mobile Emulator 10.0.10240.0 not launching the OS

I have Windows 10 Pro installed (Hyper-V activated) and Visual Studio Enterprise 2015 (with "Universal Windows App Development Tools" and "Windows 8.1 and Windows Phone 8.0/8.1 Tools" installed) . I can launch succesfully all Windows Phone 8.1 Emulators but if I launch Windows Mobile Emulator 10 that is what happens:
The Phone Emulator opens properly with the write "Loading...".
After a while appears the write "OS is starting...".
Finally (after 5-10 minutes) the write disappear without launching the OS, the emulator just stays open with the black screen.
Visual Studio doesn't give any error so I really don't know what is the problem.
I also tried to launch the emulator directly from Hyper-V (right click on the emulator->Connect and then Action->Start) but the window just stays black. It seems I can't load the OS.
Any suggestion would be appreciated.
Open your HyperV, Open Visual Switch Manager .
Find VisualSwitch related to the Emulator ,click on it .
In Connection Type ,set connection to Private network ,Then press OK and restart your PC .After restart do the same and change Connection Type to Internal network and then restart.
Then it should work ,I guess!

Resources