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
414 views
in Technique[技术] by (71.8m points)

emulation - Pairing Android and Wear emulators

I don't have an Android Wear, nor do I have a phone running 4.3. Is there a way to connect the JB 4.3 emulator and Android Wear emulator for app development?

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

After reading a blog post a few days ago I finally managed to connect an emulated Android-Device to a Wear-Emulator.
Here are the different steps that are necessary:

Step #1

Create a new emulator that is based on the Google APIs platform, otherwise you won't be able to run the Android Wear Companion app since it requires the Google Play Services. (See Android Developer site)

Emulator with Google APIs

Step #2

Start the Phone Emulator and install the Android Wear Companion app via the following command

adb install name_of_the_file.apk

You can download the latest apk from here.

Step #3

Start the Wear-Emulator.

Step #4

Open the Android Wear App on the Phone Emulator. Accept the TOS and so on.

Step #5

Open your command prompt and make sure both emulators are recognized with the following command

adb devices

Output should be something like this:

List of devices attached
emulator-5554   device
emulator-5556   device

In my case emulator-5556 is the Phone. You can find this by looking at the Window-Title of the emulator.
See the following Screenshot:

Emulator window title

Step 6

Open your command prompt once again and start a telnet session on the port of your smartphone emulator:

telnet localhost 5556

Afterwards it'll try to connect and if it succeeds it'll show a new window saying something like this:

Android Console: type 'help' for a list of commands
OK

Now enter the following command:

redir add tcp:5601:5601

Afterwards it should say OK.

Step 7

Open the Android-Wear companion app once again and click on the watch-icon in the ActionBar and if everything worked it should connect to your Wear-Emulator.

Result image

And, as previously said, this was posted on kennethmascarenhas blog. (props to him)


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

...