How to debug and run Android apps on a Samsung Galaxy S3 device with Eclipse on Windows.
Using Eclipse on a Windows development machine, I’d managed to get USB debugging working on various Android devices with various versions of Android without too much drama. But I ran into some difficulties when I tried to debug an app on a Samsung Galaxy S3 (GT-I9300T with Android 4.3).
I think I’m beginning to detect a pattern emerging — the more recent the Android version, the more (unnecessary?) development hoops to jump through. (Because Security! Apparently.)
So here’s the full process I ended up going through to make everything work. The following worked for me on both a Windows 7 machine, and a Windows 8.1 laptop. (But as always, YMMV.) I suspect the process would be the same for the Galaxy S4 and S5, as well as other recent Android 4 devices, with the only difference being the USB driver required.
First thing, as usual, is to enable USB debugging on the device:
- Open Settings, go to the More tab and select Developer
options. If you don’t have any Developer Options then:
- Scroll down and Select About device.
- Scroll down to reveal Build number.
- Tap Build number seven times.
- Navigate back to the previous screen, and you should now find a selection for Developer options has magically appeared. Select it.
- Enable the USB Debugging option.
When developing on Windows, an OEM USB driver is required. I installed the Windows USB driver from the Samsung website.
You may need to reboot at this point, especially if it’s a Windows 7 machine you’re using.
This next step is surprisingly significant. Before connecting the Galaxy S3 to the PC via USB, turn on the device and unlock the screen. Do whatever you need to do to prevent the phone from turning off/sleeping/locking until you’ve got Eclipse to recognise it.
With the phone on and the screen unlocked, connect it to the development machine with a USB cable.
Windows will then hopefully detect the device and do some driver installation. Wait for it to finish. But watch the screen on the phone.
At some point you should see a dialog pop up asking if you want to “Allow USB debugging” from this computer.
Eclipse (and adb) should now be able to connect to the Galaxy S3. If you look in the Devices tab in the DDMS perspective, you should see the device listed as “Online”:
If so, you should now be able to use Eclipse to run apps on the device in the usual way (Run as Android Application).
If not (if the phone comes up as “unauthorized” or “offline”), try switching the USB connection option on the phone from MTP mode to PTP, then back again. This should make Windows reload the drivers, and then the “Allow USB debugging” should appear.
It’s possibly worth pointing out at this point, if you find nothing works, try a different USB cable. In particular, keep the cable that came with the device handy (and labeled, if necessary!). I once wasted a lot of time trying to get Eclipse to connect to my S3 using a USB cable that just happened to by lying on my desk at the time, all to no avail. It would charge, but not do anything else. Turns out that one particular cable, for some reason, just doesn’t work. Switching to a different cable did the trick.