Android Tutorial Android 4.2+: ADB using USB & Developer Options

Kevin

Well-Known Member
Licensed User
I recently ran into some issues after an update to my Galaxy S3 and after seeing a related post, I decided to write this quick tutorial. I didn't see information on this elsewhere in the forum.

Prior to Android 4.2 it was pretty easy to find and enable USB debugging under Developer Options, but this changed in 4.2.

Enabling Developer Options in Android 4.2 or newer:
  1. Go to Settings menu on your device.
  2. Scroll down to 'About' or 'About Device' and press on it. In some devices the 'About' menu will be under the More or General tab. Some other devices you will have to go to Settings > About > Software Information > More)
  3. Scroll to 'Build Number' and tap it 7 times.
  4. After tapping 7 times you will see an alert saying 'You are now a developer / Developer mode has been enabled'.
  5. Now if you go to your Settings menu, you will see the developer options menu over there.
  6. Tap on the Developer options and then turn on USB Debugging.
Using ADB over USB in Android 4.2.2 / 4.3 or newer:

Starting in 4.2.2, Android introduced an ADB security feature called ADB Authentication. What this does is forces you to allow or deny a PC to access your Android device using ADB. When allowed, a key is stored on the device which automatically authorizes that PC in the future. If you have been developing for Android for a while as I have, it's easy to neglect updating your Android SDK installation. In order to connect to an Android 4.2.2 / 4.3 device using ADB over USB you must have SDK Platform-tools release 16.0.1 or higher installed. If you have an older version of Platform-tools installed, you simply will not be able to connect using ADB over your USB connection. To install the latest Platform-tools version, run your Android SDK Manager. If you are running a particularly old version of Platform-tools as I was on that computer, you may need to update it several times in a row in order to bring it up to 16.0.1 or newer.


I hope this helps someone. This happened to me on a computer I rarely use for Android development and it literally took me hours of going nuts trying to figure out why it suddenly stopped working. This was my first time working on my app after my phone had updated and I was unaware of the security changes to ADB.
 

Gregg Homan

Member
Licensed User
I can't connect my Windows 7 laptop running B4A to my Droid Maxx using ADB via USB connection and I am perplexed as to why for I took all of your advise above which I thank you for.

My Droid Maxx running Android V4.4 with Unknown Sources and USB debugging both checkmarked. My Windows 7 laptop has the following SDK components installed: SDK Tools V22.6.2; SDK Platform Tools V19.0.1; SDK Build Tools V19.0.3; SDK Platform API 19 Rev 3; Google USB Driver Rev 9. I have regular USB cable connecting my Droid Maxx to my windows 7 laptop running B4A V3.80.

I get no sense that B4A IDE is recognizing that it is connected to my Droid Maxx and the B4A IDE fails to detect any device when I attempt to program the Droid Maxx. BTW, I have no problems programming my Droid Maxx using B4A Bridge via wireless connections; but I can not program using a standard USB cable for some odd reason. Am I missing some obvious step?

Thanks,
Gregg
 

jamesnz

Active Member
Licensed User
I've never been able to connect my samsung galaxy camera via usb, what's worse is when using my wifi connection the logging is very unreliable, sometimes ( like for the last 3 days) it decides not to log anything at all. I have rebuilt projects, reset routers, reinstalled USB drivers, the android sdk, rebooted everything many times. tried rapid and legacy, same results using 3.8 and 3.5.
so now I basically have to build the app each time and log the output to labels on the screen.
 

Erel

Administrator
Staff member
Licensed User
Have you set the USB computer connection option to PTP?
 

jamesnz

Active Member
Licensed User
Ok, problem solved !
A friend of mine had the same device, so I tested it, to my shock it worked, so I went to demonstrate that mine did not, but suddenly my device did connect. I played around for a few minutes before I noticed the only difference was we were using his usb cable !
It seems that the usb cable I used (source unknown - possibly from another phone) did not allow debugging
Debugging via USB now works fine. I've tested all the other cables in the house, they seem to work fine too.
 

Kevin

Well-Known Member
Licensed User
Interesting find! After reading about your cable problem it reminds me of a similar problem I had a while back with a USB hub that was going bad. Another thing to consider when everything seems to be correct but it still doesn't work.
 

wcieslik

Member
Licensed User
Yesterday I had similar prblems with being unable to connect to ADB.
It was working fine a few days ago ...

Tried all the cables I could find, as this has been a source of the problem in the past. (but doesn't explain why the cable I used a few days ago now would not work!?!?)

aslo rebooted a both the phone and the computer a couple of times...

I checked the Microsoft update status and found that between the last time I used this and now, a new update had been installed. KB3035583.

I uninstalled this update, rebooted and viola ... all good again !
 
Top