original source : https://developer.android.com/training/wearables/apps/debugging.html
실제 기기들을 이용해서 하는 debug 설정
mobile은 usb로 개발용 컴퓨터에 연결, wear는 bluetooth를 통해 mobile을 거쳐 r개발용 컴퓨터에 연결하는 방법
Enable Developer Options on your watch
Before you can debug on your watch you must enable developer options. You only need to do this one time. Developer options remain enabled until you disable them.
- Open the watch’s Settings.
- Tap System > About.
- Scroll to Build number and tap the build number seven times.
- A dialog will appear confirming that you are now a developer.
Debugging over Bluetooth
Bluetooth debugging only works for Android-paired watches. Before you begin, be sure the watch and phone are paired and you’ve enabled developer options on the watch. You should also be sure that developer options is also enabled on the phone. To check, open the phone’s Settings menu, selectAbout phone and click the build number seven times.
Enable USB debugging on the phone
- Open the phone’s Settings menu.
- Select Developer Options and enable USB debugging.
Enable ADB/Bluetooth debugging on the watch
- Open the watch’s Settings menu.
- Scroll to Developer Options.
- Confirm that ADB debugging is enabled.
- Enable Debug over Bluetooth.
Enable Bluetooth debugging on the phone
(mobile기기에 설치된 android wear 앱의 기본화면)
(mobile기기에 설치된 android wear 앱의 설정화면)
(하단의 Debugging over Bluetooth 을 enale해야한다. 5번 내용)
- On the phone, open the Android Wear companion app.
- Tap the Settings icon.
- Enable Debugging over Bluetooth. A status message appears under the option. It looks like this:
At this point the development machine (the host) is not communicating with with the watch (the target). You need to complete the link.
Connect the debugger to the watch
In this final step, you’ll use everything: the debugger, the phone, and the watch.
C:UsersjacobAppDataLocalAndroidsdkplatform-tools> 경로안에 adb 가들어있다. 그러므로 이 폴더 안으로 들어가서 아래 명령어를 실행한다.
(이작업은 handheld기기가 컴퓨터와 연결이 끊어지거나 android studio 가 새로 시작되면 매번 다시해야 하는 작업이다.)
adb forward tcp:4444 localabstract:/adb-hub
adb connect 127.0.0.1:4444
Note: You must use the IP address 127.0.0.1. You can use any available port on your development machine. Be sure you use the same port in both commands. (In this example the port is 4444.)
The watch is now connected to the debugger and you’re ready to start debugging.
When you debug a watch using Bluetooth, adb always uses the IP address
127.0.0.1 plus the port that you assigned. Therefore, all adb commands use this format (continuing the example, the port is 4444):
adb -s 127.0.0.1:4444 <command>
If you are not using the emulator and have only one device connected for debugging, you don’t need to specify the address at all:
Option 2 – Manually (just the platform tools)
This is the easiest way to get a manual installation of ADB and Fastboot.
Delete your old installation (optional)
rm -rf ~/.android-sdk-macosx/
Navigate to https://developer.android.com/studio/releases/platform-tools.html and click on the
SDK Platform-Tools for Mac link.
Go to your Downloads folder
Unzip the tools you downloaded
Move them somewhere you won’t accidentally delete them
mkdir ~/.android-sdk-macosx mv platform-tools/ ~/.android-sdk-macosx/platform-tools
platform-tools to your path
echo 'export PATH=$PATH:~/.android-sdk-macosx/platform-tools/' >> ~/.bash_profile
Refresh your bash profile (or restart your terminal app)
Start using adb