I'm basically trying to do this:
Changing the Android emulator locale automatically
Everything works up until 'start'. the emulator starts to boot but keeps loading at the shimmering 'ANDROID' screen forever. I must be missing something... How can I restart the emulator from ADB?
Okay, I should be more specific.
I am trying to do this from the command line using adb. I can use adb to setprop and I can stop the emulator. When I try doing 'start' in the adb shell, the emulator does begin to boot, but it never returns to the lock screen.
In Android Studio go to:
Tools > Android > AVD Manager
Select your emulator device
Click "Cold boot now" to restart, or "Wipe data" to factory reset
you can try
emulator #avd_name -no-snapshot-load
it will clean load the device it worked for me.
You asked how to restart the emulator from ADB. But the title is framed in a way that pops the question up when searching about restarting it from the UI as well.
One option could be (but it depends on which tooling you are using and may not be available for all emulators/environments) is to tap and hold the Power button and then a menu will pop up with a Restart option in it.
This was a long-standing default behavior, but since Android 12 / API 31 it tries to open the Google Assistant instead (even when there's no such thing on emulators without Google APIs or Google Play 😵). The old behavior can be reverted by going to Settings > System > Gestures > "Press and hold power button" to bring up the menu in the screenshot.
To restart a running emulator I used
adb -e reboot
(Assuming there is only one running)
I'm pretty sure this will work:
Clear/Wipe the AVD to defaults or create a new one.
Start the AVD/Emulator from the CLI with the following command
emulator -avd my_avd -prop persist.sys.language=en -prop persist.sys.country=GB
change as needed. That way you are not messing with the system image which can cause hangs/crashes. And you can easily set it on boot for a variety of Locales.
If you are using Android Studio, you can goto the AVD Manager, Under Actions select "Cold Boot Now" to restart the emulator. This would get rid of errors/discrepancies which might occur if the simulator's process has been abruptly closed/terminated.
For me, kiran-chenna's answer failed me, and the solution was to instead run:
emulator -avd Pixel_2_API_28 -no-cache
In my case, a cold boot was required after the emulator got stuck. It can be found in the Android Virtual Device Manager.
on Android 13, when you swipe down to the notifications, and swipe down again, you get a power off button on the bottom right:
which has the Restart option:
Follow the following steps to restart/cold-boot your virtual device:
Open Android Studio
Click on Configure
Click AVD Manager
Click on the Dropdown on the right hand side of the virtual device.
Click on Cold Boot Now
You're done! The device will restart within a couple of minutes.
2022 Android Studio Bumblebee: With the emulated device open on screen (the "Emulator" tab open), press and hold the power button at the top of window just as you would on a real device, and it will pop up the device's menu just as if you had held the button on the side of a real device. For example:
If the power button (top left of Emulator) is opening up assistant:
Tell/type to Assistant to open "Settings" (or double drag down the battery/antenna icon on top right)
Search for "Power"
Go to "Power Gesture"
Turn that off!
To start/stop or restart emulator follow these steps:
using telnet on windows machine
or localhost 5554
avd start start
or
avd start restart
or
avd stop
Some versions of the emulator (android-7) are buggy and just hang at the shimmmera.
Try restarting it with "wipe user data" option (yes, you will have to re-run your
app or at least reinstall it).
You can try this
emulator #avd_name -no-snapshot-load
or else Simply delete the existing AVD and try to create a new one.
By following the steps.
In Android Studio > Tools > Device Manger > Create Device
you can restart the emulator from adb shell,
start the emulator and also adb shell in the terminal.
start Starts (restarts) an emulator/device instance.
stop Stops execution of an emulator/device instance.
in eclipse in the top most right u will find DDMS go i there, left side you will find Devices and in that in the last you will find a triangle downwards press that in that you will find Reset adb.
Related
How to get x and y coordinates of mouse over.
I have a service in android and which is connected to .net application via eneter messaging framework. I wants x and y position of mouse from service. I want mouse positions not only on clicks but also on mouse over.
Many thanks
Maybe not a best solution but atleast it works.
Both solutions are based on Genymotion emulator.
Solution #1
You need to install Genymotion emulator.
Run emulator from VirtualBox app, wait a bit until you see a few lines like "init: untracked pid ... exited"
Run the same emulator from Genymotion launcher.
Now you can simulate mouse by moving it in VirtualBox app window (not genymotion window).
Depends on how long you wait before you do step 3, android can appear in genymotion or virtual box window.
Solution #2
You need to install Genymotion emulator.
Run VirtualBox app, go to your virtual box "android emulator":
Settings -> Display -> Remote Display -> Check Enable Server
Run android emulator through the genymotion launcher.
Connect to your virtualbox with:
$ rdesktop -a 16 localhost:3389
While you move cursor in rdesktop, you can see pointer in genymotion android emulator window. Now you can intercept hover events.
There is maybe a better solution - disable mouse integration for virtual machine, so, virtualbox can grab mouse cursor, like:
$ VBoxManage modifyvm "your-vm-name" --mouse ps2
but it doesn't work for me, maybe genymotion launcher overrides settings on every launch?
Links:
http://developer.android.com/reference/android/view/View.OnHoverListener.html
p.s. hover events are available starting from api 14.
You can also use Android x86 in Live CD mode (or install it in dual-boot with Windows).
Is there a way to bring android emulator from offline to online mode without closing AVD?
I tried adb's 'kill-server', 'start-server' commands but this just seems to re-start adb server (adb.exe process), the emulator is still in offline mode and 'adb devices' still show 'offline' state.
Also can someone explain what exactly 'offline' mode of emulator means.
In my case - Emulator (standalone), daemon process and ADB server - all seem to be running. Why is emulator state still offline?
Updating Question:
I have tried 'adb reset' both from Eclipse & command line that does not solve the problem. Issue seems to be more with Emulator Memory. Per my analysis memory of emulator keeps increasing and after a limit (~470 MB in my Windows) if you try to do a adb reset - it brings the state of emulator to offline and no more adb commands work. (also no network calls seem to be working)
If you just created the emulator, in the emulator settings:
1.just click on "About the emulator" -> "Build Number" about 5-7 times.
2.This will open "developers options", go back and click on it and enable "USB debugging"
to bring it online.
Use these commands from the command prompt it will help u
1.adb kill-server //kill all active server
2.adb start-server //start adb server
3.adb devices //check the list of active server
Sometimes/most of the times the solutions described above works. But if it does not, and you had "Launch from snapshot" enabled, killing the emulator and restarting it WITH LAUNCH FROM SNAPHOT DISABLED, will let you of the hook.
I had this problem many, many times in the last few weeks, and although adb kill-server followed by adb devices works 4 times out of 5, that fifth time the only way to get it working again is by disabling the 'launch from snapshot' option. My guess is that the emulator is somehow in a 'wrong' state, but do not understand why myself.
I have faced this problem many times. Some solutions are:
Solution 1:
the emulator
Select & Right Click on Android Project
Run Configurations
Go to tab Target
Enable option Wipe User Data on Emulator launch parameters
Run Application
Solution 2:
Run Emulator
Keep the Emulator, (no matter same error occurs)
Make Sure the Home Screen of Emulator is appeared
go to Window -> Show Perspective -> DDMS --> In Devices Panel -> on Corner Drop Down Menu
Reset adb
Solution 3:
Reset adb manually or using the command line.
Might be helpful for a new user.
This issue can be solved using the below steps:
Open AVD-Manager in android studio and choose the emulator which you want to run
and do the wipe data and cold boot, take reference from the attached pic:
If the doesn't work, go to emulated device and enable the developer options >
enable USB debugging.
When I try to debug using one of the configurations that I've set up (for example Android233), the emulator never actually launches. I just see a little green icon in my task bar that says "launching Android233," but it never launches. I've let it sit there for hours and it never does anything. I don't know if this is related, but my emulators don't show in device view in the DDMS perspective. I have a physical Android device, which shows up in device view. My question is, what is happenin' and how can I fix it?
Thanks for taking the time to read my question :)
I thought I had the problem figured out, but it stopped working again. Here's more information: When I run my debug configuration, in the lower right corner of my Ecplipse windows it says:
"Launching MyDebugConfig (100%)" and then there's a green icon next to it.
I looked in task manager and the emulator is not in there. I looked in DDMS and my AVD is not listed and there is nothing in the LogCat or Thread or anything else for that matter. I have my debug configuration set to prompt me to pick a device, but it never does that. It just loads my AVD, even if I have my phone connected (which is visible in DDMS). I'm so stumped. I've had this problem since I started using Eclipse and I don't know what to do.
Thanks.
Go to DDMS Perspective =>Click View menu=>reset adb
If Your genymotion virtual device is not seen in android device monitor then just try this.
1. start android studio
2. start Android Device Monitor
3. Lastly start the genymotion virtual device it will appear
The emulator won't show up in the DDMS section until its running.
The emulator won't lunch probably because you misconfigured it, currently the lunch dialog of the emulator doesn't support error messages, however you can get the lunch stack trace while you try to lunch the emulator via Eclipse.
Disconnect your physical device, run your project and select the emulator. you should see an error message on DDMS console.
If you in Windows try run (after starting emulator)
adb.exe kill-server
adb.exe start-server
and wait for restarting your adb
When I try to run the Hello World app with Eclipse, the Console shows "Waiting for HOME ('android.process.acore') to be launched...", but even if I wait for half an hour, nothing happens except for the emulator showing the "Android"-logo on a black background.
The same happens when I try to start the emulator directly via AVD Manager. The PATH variable is set correctly, I've installed the newest versions of both eclipse and the Android SDK.
What could possibly be the reason for this to happen?
Thanks!
Problem is in SD Card follow this steps,
1) Select Window option from eclipse menubar
2) Goto AVD Manager and select the emulator (which got probs after started).
3) After selecting Emulator, click Edit button which is on your right hand side of the AVD Manager
4) Goto SD Card Size give 128 and then click 'Edit AVD' option down
5) And restart your emulator
It worked for me when I selected 'Use Host GPU' option under 'Emulation Options:'.
You can find the option under Edit window of the virtual device.
Try the path it can be the issue.
My advice - if you having an android phone.. please usb debug it and Debug your application on your phone. You will feel relieved from the long durations of the emulator to
"Waiting for HOME ('android.process.acore') to be launched.."
I found that the keyword here is 'wait'. I gave up waiting many times on a slower laptop. When I switched to a faster desktop and left it alone for a good while the emulator eventually booted up. Think how long it takes your android device to boot up, then consider that is running as an emulated ARM processor + the rest of the SoC architecture, on just 1 core of your actual real life x86 processor.
Also, I was giving the SD card a GB or so "just in case", this just slowed it down even more as it had to allocate this space on the slow laptop hard drive before it even began booting the emulator.
Just being a little patient worked for me, and once the emulator is up and running don't close it! You can simply close the program you are testing on the virtual device and then re-upload/install with eclipse again and again as you test your code.
Are you sure the path is set correctly? The path variable should be set to both SDKHOME/tools and SDKHOME/platform-tools, where SDKHOME is your android sdk home folder.
Most of the time, people forget this and just set the path to /platform-tools or the other one only.
Another possibility may be that your computer is running out of disk space.
Waiting for HOME ('android.process.acore') to be launched...
I did not run my emulator then I start to run my app. But my emulator stayed black screen and there are console ms "Waiting for HOME ('android.process.acore') to be launched...".
I stop my app then I setup my emulator before I run my app. It run perfect.
Run your emulator first from Window -> AVD Manager -> (select your emulator)Start
Done.
My main problem with developing in Android is that the emulator seems to continually get disconnected from eclipse. This always happens the 2-3 time I try to upload my .apk from eclipse without rebooting the emulator. Eclipse indicates this with an empty DDMS ->Device section and logcat stays blank - sometimes I'm not sure if the new code made it on the device.
The only fix I have for this is to shut down eclipse, and restart it. With the restarting of Eclipse, on top of the emulator boot time, I can't get any momentum going in my development.
Is there a way to reconnect the emulator to eclipse without having to restart Eclipse or even the Emulator?
Update: There were a couple of answers that helped, particularly "reset adb" or Kill-server -> connect adb. However, sometimes even that is troublesome.
I am going to try Pentium10's suggestion of hooking up my G1 and using it as an emulator, but for now, I have found that if I don't see my logcat going, and the emulator is working (This is my biggest problem, because I am outputting all my debugging messages to log) then I can open up CMD and type adb logcat. This streams the log into the command window. Not nicely color coded, but nice enough for me to find my problems...
In eclipse go to Window->Show View->Other->Android->Devices. When your application is run go to this tab and you will see the emulator. If your emulator becomes unresponsive, in the devices tab you will see a down arrow at the right. Click the arrow and a context menu shows up. Hit the option Reset adb.
Just had to do this and it worked beautifully, but it did require you to reset the emulator - though I didn't wait to see if it reconnected on its own.
Try to call 'Reset adb' menu item from DDMS > Devices tab. It helps me in this case.
At most of the time you don't need to restart the emulator.
AFAIK the only workaround for this is to restart Eclipse (I always use this), or use a real phone.
Try adb kill-server, followed by an adb connect
I've had luck reconnecting to the disconnected emulator by entering an adb-over-tcp command line which you can look up in the docs. I think the address and port to use are the ones in the title bar of the emulator window, if not try the next higher port. Once it's back in adb devices eclipse should use it.
in terminal:
$adb kill-server && adb start-server