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.
Related
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)
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.
I'm connecting a webcam to my emulator by setting the front camera to "webcam0" in the AVD Manager.
When I launch the webcam from Android studio's AVD manager or using emulator -camera-front webcam0 , I get the following window:
and when the emulator has showed that is an error
Please help me how to fix that.
Go to Android Virtual device manager>>select the emulator>>click edit>>select Advanced Setting>>camera select as Emulated rather than Webcam0 .
I got this error on new android emulator and was able to fix it by selecting emulated options for both Front and Back camera and clearing Camera App's Cache & data.
The solution for me was : " start Android Studio via command line vs starting it the usual way " Doing so makes Webcam0 work inside the emulator.
On my Mac I simply typed
/Applications/Android\ Studio.app/Contents/MacOS/studio
into terminal. I also used Automator later to create a workflow which runs the script (command above), and saved the workflow as an app.
Using such Android Studio launcher.app launches Android Studio.app for me via command line.
Android Studio:
Tools > AVD Manager
select the Device & click edit
click Show Advanced Setting
Camera select as Webcam0
Click >> Finish
Download the free personal use version of genymotion and use that emulator instead of the one that come with Android Studio.
Like you, I've been trying all morning to make my webcam work with the emulator that comes with android studio without success. 0 problems with genymotion so far.
In my case, just change configuration -> saved -> turn on device (cold boot notification will appear) -> then turn off device -> revert change -> turn on again.
I don't know but it works for me. Maybe it just cache problem. CMIIW.
but if you are using bluestack emulator or any other emulator.
then in emulator first open emulator camera then click photo of that
then again your own application in emulator and click button of camera ..i must be work ..
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.
I must be missing something totally obvious, but I can't find a simple way to simply stop an app from running. I'm running it on my HTC One.
I first tried toggling the green run arrow. Didn't work.
I found a "Terminate Application" circle in the lower left of the window. That doesn't seem to do anything when you click it. It seems to be grayed out, non-functional. Screen shot here
http://www.screencast.com/t/VLTOzPQ7
So, I closed the entire project. That worked, but also the entire Android Studio closed instantly. Then reopening Android Studio failed (stack dump). Then reopening again worked, but it took 30 minutes to load my project.
To stop the next time, I turned my phone off, then closed the project. That seems to have worked better, since it took me to the Welcome to Android Studio screen and invited me to open or start a project.
Maybe there's an easier way to stop an app? I see the same question on this forum but no solutions.
The Android Studio controls you are trying to use only work if you are running your app in the emulator. There are a few ways to do this when you are using an actual device or VM (e.g., Genymotion):
Use the UI of the phone to Force Stop the application. This is done in the Settings->Apps menu.
Use Android Studio's terminal window or the host's shell and issue the command:
adb shell am force-stop <package-name>
Open Android Device Monitor (green "Droid" icon), select the process under the Devices tab and click the Stop Process button (stop sign icon). This is basically the GUI way of doing #2.
You need to select the process you want to terminate (ex. com.myname.myapp) then click terminate application.
Since the application is running on your phone, you need to end the application process on the phone. When you do that the application would be shown as terminated on Android Studio.