I am having issue with android emulator and it is not starting the device. i am using linux mint. this error is shown
5:49 PM Emulator: emulator: ERROR: Unknown AVD name [Pixel_2_API_29], use -list-avds to see valid list.
5:49 PM Emulator: Process finished with exit code 1
i dont know how to list avds .
i was able to run it from the command by using
sudo ./emulator -avd Nexus_5X_API_29_x86 -use-system-libs
BUT not working in avd managers window.
Please run following commands step by step..
1.adb kill-server (To kil adb server)
2.adb start-server (To start adb server)
3.adb devices (To list avds)
Related
I had to edit my emulator' hosts file in order to connect to a local development environment. I have followed this steps:
Run the emulator:
~/Library/Android/sdk/tools/emulator -writable-system -avd Nexus_5_API_19
In another terminal/cmd prompt:
adb reboot
adb root
adb -s emulator-5554 remount
adb -s emulator-5554 pull /system/etc/hosts hosts
add the IP to host file
adb -s emulator-5554 push hosts /system/etc/hosts
adb reboot
Now whenever I try to start my emulator from AVD Manager it is not responding. I always have to start it with:
~/Library/Android/sdk/tools/emulator -writable-system -avd Nexus_5_API_19
I mention that I work from High Sierra.
I faced same issue. You can do following to resolve this
adb remount
Cold boot: android studio > avd manager > select the avd> drop down select cold boot
The emulator will start up.
close emulator
Now you can start emulator normally.
I try to edit android emulator's host file.I follow steps:
step1
adb root
step2
adb remount
step3
adb pull /system/etc/hosts .
then I add new line for customer host information,then I push hosts file,I get some errors:
step4
adb push hosts /system/etc/hosts
error information:
adb: error: failed to copy 'hosts' to '/system/etc/hosts': couldn't create file: Read-only file system
envirements information:
osx ei capitan
android emulator: android 7.1.1
android studio: 2.2.2
I just ran into the same problem and made it work.
Run the emulator:
emulator -avd <EMULATORNAME> -partition-size 512 -writable-system
I believe that -writable-system param is the thing that fixed it for me.
In another terminal/cmd prompt:
adb root
adb -s emulator-5554 remount
adb -s emulator-5554 pull /system/etc/hosts hosts
Now, work your magic (add the IP to host file)
adb -s emulator-5554 push hosts /system/etc/hosts
Additional info:
emulator-5554 is the device name, you can find yours with adb devices
emulator program is located inside android-sdk/tools
adb program is located in android-sdk/platform-tools
Important update from comments:
Please check the comment from steven to this post about running adb reboot before running adb root.
This might be important to being able to start the emulator from AVD manager.
Captain suggests to run adb reboot after pushing the host file to avoid blackscreen error.
Happy debugging :)
After pushing the hosts file run adb reboot and you will have no problem with the black screens anymore.
I had problems with the other solutions, so i tested a lot and now i decided to write another answer and i hope it is useful for others.
Here are my steps to success (Android Studio on win 10):
Start Android Studio and open the AVD Manager and start your
Emulator.
Open a powershell and navigate to your android sdk/platform-tools/
.\adb.exe reboot -writable-system (your emulator should reboot now)
.\adb.exe root
.\adb.exe remount
.\adb.exe pull /system/etc/hosts C:\Temp\hosts
Èdit your hosts file
.\adb.exe push C:\Temp\hosts /system/etc/hosts
.\adb.exe unroot
Now you can open a browser in your emulator and open your custom domain to check if your hosts file has been changed.
Click the close-icon of your emulator to force a shutdown with snapshot saving. You should see a "Saving state..." message.
Now start your emulator again from AVD Manager. Your hosts file should persist. So check your domain again.
I had very strange issues with unstartable emulators after booting in writable-system mode, rooting and stopping emulator without doing the unroot. The problem is: whenever the snapshot fails the emulator will do a cold boot and your hosts file is gone. You need to repeat all the steps in that case.
I'm trying to run the Hello-World app of Phonegap on Ubuntu 16.
"/my-app# phonegap --verbose run android"
But no matter what it always takes very long and finishes with an error:
"Running adb shell command "getprop dev.bootcomplete" on target emulator-5584..."
"Running command: adb -s emulator-5584 shell getprop dev.bootcomplete"
"Command finished with error code 1: adb -s,emulator-5584,shell,getprop,dev.bootcomplete"
I've creating different avds and running everything as root user but no change.
Any suggestion what this "error code 1" means would be highly appreciated - I could only find other error codes with the search.
Try running adb kill-server and restart doing all the process again.
EDIT:
Try starting emulator with ubuntu cmd:
LD_PRELOAD='/usr/lib/x8stdc++.so.6' ~/Android/Sdk/tools/emulator -netdelay none -netspeed full -avd Nexus_5X_API_21
where Nexus_5X_API_21 is your emulator name
~/Android/Sdk/tools/emulator is your path where emulator is stored
Do this after adb kill-server, then on another cmd tab, try running
phonegap emulate android --verbose
I have created an emulator on my mac machine. When I try to launch the emulator manually from avd manager, I am successful. Also, if I launch the emulator on the command line by
emulator -avd nexus5_api21
the emulator starts. But when I write a small shell script to do the same, like
#!/bin/bash
echo "hello"
emulator -avd nexus5_api21
my emulator doesn't start. It complains, that it couldn't find the .ini file. But the same command works, when I do it separately by opening a terminal. I don't have to go to a specific location for running this command successfully.
I don't understand, what the difference between the command line and the shell script is.
You have an error in "shebang line" of your script. It should look like
#!/bin/bash
emulator -avd nexus5_api21
voila!
I would like to advice you to get familiar with shell scripting.
I created my android virtual device using command as folow:
android create avd --target 1 --name emu --abi x86
then I tried to run emulator:
emulator -avd emu &
during the emulator starting I was trying to make command as follow:
adb shell
but I had an error:
error: device offline
and when i made command:
echo $?
I had output "1" until emulator get started.
Is it any possibility to check current emulator state using the terminal command?
You can use another terminal window and type adb logcat commnad.