Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
269 views
in Technique[技术] by (71.8m points)

How to get Android AVD name from adb device name

Using the Android SDK from the command line, I can get a list of the running devices available using:

./adb device

This gives me the serial number of available devices. How can I get the AVD name of the emulator device from that serial number (like the Eclipse ADT plugin does)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Eclipse plugin does it by connecting to the emulator via tcp/ip. To connect, (for linux), type

~/code$ telnet localhost 5554
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Android Console: type 'help' for a list of commands
OK

Replace "5554" with whatever number comes after the hyphen when you type "adb devices" - "emulator-5554", for instance, would have telnet port 5554 open.

Then, type "avd name", hit enter, and you should see something similar to the following:

avd name
GB10
OK

In this example the emulator's name was "GB10".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...