Android Emulator got discharged completely - runni

2019-06-16 17:06发布

问题:

Good evening friends, I am a newbie to android. My problem is, when ever I started emulator, it is showing battery as nill and the message as connect to charger. While I am searching for this over internet, I came across using the Telnet commands. I have used the following commands -

telnet localhost 5554
power capacity 100

This is crashing my application. Not only the power command, but also other commands except help. I have tried changing the power to 99, 70, 20, etc., nothing made difference in the output.

For this, I have tried the suggestion given in this article.

I also have tried solution given in this question.

This question might look as a duplicate of already existing questions. But, I have tried all those solutions,

I have

  • reinstalled eclipse
  • reinstalled android-sdk
  • reinstalled avd manager
  • recreated existing AVD

I am using Intel Atom (x86) Emulator. The target is Android 4.3 with API level 18.

I have also followed the instructions and suggestions given over here like changing the hw.battery option in the config.ini file in .android\avd\ folder.

回答1:

The solution is to set the hw.battery=yes in the AVD config.ini file as described here:

https://stackoverflow.com/a/17467342/2232812

  1. Go to your Android Virtual Devices folder. On Windows 7 it's this folder for example:
    C:\Users\{yourUserName}\.android\avd\{yourAVDName}.avd

  2. Open the config.ini file

  3. Set the battery option to yes: hw.battery=yes
  4. Restart your Virtual Device and be happy :-)


回答2:

Atlast, I was able to run the emulator exactly how I wanted. I checked the list of devices using adb devices. At first, I got nothing tin the list. Then I run this command adb connect <ip address of the VirtualMachine>. Then, I opened Run configurations. I saw the Virtual device in the list. I selected it and started running my application.



回答3:

This could be a bug in emulator when using telnet, and by the way this is OS independent issue, it may appears in Microsoft Windows, or in Linux. see the issue page:

https://code.google.com/p/android/issues/detail?id=39959

I tried many solutions, but all failed, however when I delete the AVD and create new one the problem disappeared.

regards,



回答4:

I use Window 7 and i had the same problem with the emulator. When i oped the config.ini file i had to put the backspace character in each line because all the file content was in one single line like this:

avd.ini.encoding=ISO-8859-1hw.dPad=nohw.lcd.density=240hw.cpu.arch=armhw.device.hash=499058361

..... and so on

after formatting it looks like this:

avd.ini.encoding=ISO-8859-1
hw.dPad=no
hw.lcd.density=240
hw.cpu.arch=arm
hw.device.hash=499058361

That works for me. Now the emulator accepts pretty much all the commands.