This is my solution for windows 7 and Moto phone. I hope it works for other versions of windows and android.
Make sure developer options and USB Debugging is enabled on your android phone (and that the phone is plugged in to your computer.)
Make sure you have adb.exe in your Android folder (For me, it's users/me/appdata/local/android/sdk/platform-tools/) . If not, you can use SDK manager to install it or download it from https://developer.android.com/studio/releases/platform-tools
Test to see if you computer detects adb.exe
- Open command prompt.
- Type: adb
- If it can't find it, it would display nothing. If it does, it should display a bunch of text (Skip next step, go to 'install usb driver')
Make sure your computer knows where to find ADB.exe
- Right click on 'computer' - click Properties.
- Select 'Advanced system settings' on the left-side menu.
- Click 'Environment Variables'
- Under System Variables, scroll down until you see "Path". Select 'Path' and click 'Edit'
- Copy the address folder where your adb.exe is located.
- Under 'variable value'- Do NOT delete what is already there! Type a semicolon at the very end after all the other paths. Then paste your folder address after the semicolon. (For me it's ;C:\Users\me\AppData\Local\Android\Sdk\platform-tools) click OK
- Under 'User variables for admin' - click 'New'
- For variable name, type: ANDROID_HOME
- For variable value, paste in the Sdk folder but not the platform-tools folder (C:\Users\me\AppData\Local\Android\Sdk)
- Open command prompt and type: adb
If it list version #, then congrats to getting past one hurdle. Yay! If not, check to see if your anti-virus software have adb in quarantine.
Install Google USB Driver (or Intel Android Driver depending on what smartphone you have.)
Use SDK Manager to install the USB Driver or download it directly on the website.
Copy the location of where it is installed. (For me, it's c:\Users\me\appdata\local\android\sdk\extras\google\usb_driver)
Update the driver on your phone. Plug in your phone to your computer.
- Right-click on computer - select 'manage'
- Click on Device Manager
- Search for 'Other Devices' and select either 'unknown device' or the name of your phone. Right-click to update driver
- choose 'Browse my computer for driver software'
- choose 'Let me pick from a list of device'
- It will have a list. Just click 'next'
- It will be empty. Click 'have disk'
- Browse for the location of the USB driver. click OK
- Select 'Android ADB Interface' and click 'Next'
- Update the driver for your phone.
If you see the message 'Windows has successfully updated your driver software' Yay!
Restart everything.
Turn OFF developer option on your phone and disconnect.
Restart computer.
Turn ON developer option, turn ON USB debugging, and connect to computer.
Check to see if computer recognizes your phone as debugging device
- Plug in your phone to your computer (Make sure USB debugging is on!)
- Your phone should prompt you with a RSA key fingerprint! (You're 99.99% there!)
- Check 'always allow'
- Click 'OK'
Open command prompt and type: adb devices
It should list your phone as a series of numbers and letters.
CONGRATS!!!
Open Android Studio and run your app. It should list your phone if plugged in.
Woo! Yay!