Installing & configuring Android Studio
I followed this book's instructions to set up my AS environment.
For the rest, I took this video as a reference. It can give you a rough idea about how to get it to work. The setup details vary from brand to brand, but the overall procedure is pretty similar, I went through the steps, but my solution is slightly different coz the presenter used Samsung for his demonstration.
Configuring HTC One M8 Mobilephone
The steps to enable USB debugging on your Android device is almost the same for all brands, the only difference for me is that HTC One M8 doesn't support PTP USB connection mode, so I have to leave it as default, which is MTP. According to the video tutorial, it should work in PTP mode though.
Installing HTC USB Driver In Windows 7
I didn't follow the instructions from that video, coz it didn't work for me.
I found the USB drivers for M8 from this link, the HTC official site sucks. I downloaded both wares provided in the webpage, and installed them.
- HTC_Driver_4.10.0.001.exe
- HTC_BMP_USB_Driver_x64_1.0.5375.msi
After installation, I can see the mobile device in Device Manager panel:
Configuring Android Studio
Go to your Android SDK installation directory, run SDK Manager.exe, and you need to install Google USB Driver:
Now you can start your AS, open your project, go to Tools -> Android -> Check "Enable ADB Integration". However, I failed at this step, the action at background is actually start ADB server by running ADB command. So I just ran the command manually:
adb start-server
is the one did the job.
Now, click Run button to run the Android app, from the popped device monitor dialog, you should see the Android device, select it.
After building, and transferring the files to your device, you should see it running on it:
Ref:
http://stackoverflow.com/questions/26137634/ddms-adb-exe-start-server-failed-run-manually-if-necessary-android-studio
http://stackoverflow.com/questions/2306322/adb-wont-start
http://android.stackexchange.com/questions/100485/switching-htc-one-m8-into-ptp-mode
https://developer.android.com/studio/run/oem-usb.html
https://developer.android.com/studio/run/device.html