Can't run my application on my Nexus 4 (unauthorized phone) - android

I was doing the Android tutorial on the Google website and I was at the point where you want to run your fantastic Hello World application on your phone. When I run my application from Eclipse, I see that my phone status is ?? and the target is unknown. When running adb devices in cmd, it says that my phone is unauthorized. It appears that it has something to do with the RSA fingerprint prompt. I don't remember ever getting such a prompt. Yes, I am running in PTP mode and debugging is enabled. I tried, after looking around on internet for multiple hours:
-Enabling/disabling debugging mode repeatedly
-Uninstalling and reinstalling my drivers for my phone or ADB
-adb-killserver and adb-startserver
-Restarting my phone and unplugging/replugging in multiple ways
I did notice that in my (user)/.android/ folder, I don't have a file called adbkey.pub (which is apparently the file that's supposed to have my key). Anyway, I don't think I've ever received the prompt about RSA fingerprint and I can't make it appear in any way.
Do you guys have any idea what I could do at this point. I tried about everything on these forums and around on the Internet but maybe there is something else I could do. Should I reset my phone to factory settings at this point to make the prompt appear again?

Make sure your android SDK is up to date (I think we're on v22.xx of the tools). Older versions fail in the manner you describe when hooked up to Android 4.2+ devices.

Do you have MTP transfer mode on? I just had this problem, solved by restarting the adb server and then disabled MTP on the phone at which point it immediately prompted for the RSA fingerprint and connected.

Related

Samsung Adb after a few days becomes un-authorized ; kill-server won't work

I am communicating via desktop to a Samsung Android phone. OS is latest. I have done "Allow always" on the same desktop I use every day for authorization of the key for secure debugging. But to my surprise, I keep getting pop-up authorization message on the phone after a few days. I do not want to kill-server all the time to make it work or anything. However, I have restarted the phone as well. My USB cable is perfect. Why is the certificate getting revoked and I have to authorize again after a few days?
Thanks
There a wide variety of possible issues with ADB authorization. You might have multiple Android SDK installs on your path, you might have bad permissions in your ~./android folder. There's a ton of answers here that might give you some ideas of where to look from the problem ADB Android Device Unauthorized
Also instead of killing the server you might be able to turn USB debugging on and off to circumvent this issue as well (though this is still tedious)

Physical devices not working in Android Studio: Multiple RSA key fingerprints but only one adbkey.pub

I develop using a pixel 2xl and a macbook pro. I have a problem that is bugging me since months now. When i connect the phone to the pc i get the classic popup asking to "Allow usb debugging? The computer's RSA key fingerprint is: xx:xx:xx:xx:xx:.....xx:xx" and then the box with "Always allow from this computer" and the two buttons "cancel" and "allow".
The problem is that i get two different key fingerprints, one doesn't work with android studio and I have to click "cancel" and switch on and off the "Usb debugging" switch until i finally get the right key.
I tried to uninstall Android Studio and all the related folders, following the How to completely uninstall Android Studio on Mac?
and when nothing was installed on the pc i still got the rogue key fingerprint on the message.
I tried to delete the only adbkey.pub and only the good key fingerprint changed. I tried to "Revoke Usb debugging authorizations" on the device but nothing. I run a "ps aux | grep adb" and no adb was running when i still got the rogue key fingerprint. No other adbkey files seem present on my pc too.
Where this rogue key fingerprint comes from? how to get rid of it?
This is seriously making my developing days a big big pain.
Thanks
I think i found finally the solution:
IMPORTANT: to diagnose the problem was essential to "Revoke USB debugging authorisations" from the developer options on the device, and never check the "Always allow from this computer". If you check that option instead, the popup will not appear and you could find yourself connected but with a wrong RSA key. In android studio you will see your device connected on the usb list but not as android device. This will look as a problem of the connection (cable, etc) but instead the connection mechanism is working, it's just that Android Studio will not be able to use it due to wrong fingerprint.
The rogue RSA key fingerprint was triggered by chrome://inspect with Discover USB devices checked. This option allows you to see the Android device without adb, so it probably mimics behaviour of the adb with its own certificate. This is a big big mistake from chrome developers, because it interferes with the Android Studio behaviour! It doesn't store the certificate it uses on ~/.Android folder in a adbkey.pub so it makes very difficult to discover the problem.
I used chrome inspect to see the database of my app using facebook stetho. I had always a tab opened and that made my last two months of coding like hell! Hope this helps someone.

Galaxy S9 Device Keeps Appearing as "Offline" when emulating

My Galaxy S9 device keeps appearing as "Offline" when I try to debug. It was working with the same application previously, and nothing changed. I receive this error: Session 'app': Error Installing APK
and
com.android.ddmlib.AdbCommandRejectedException: device offline
Error while Installing APK
Things I've tried:
I updated Android studio
All combinations of cleaning/rebuilding my project
Rebuilding APK
Double checking that I have the most up to date drive on my pc
Emulating didn't work either, but I was able to fix that by installing the Intel HAXM installer. Is there another set of developer tools I need to debug on hardware?
just today I've been through a similar situation with my MOTO G5: Everything was working just fine a few weeks ago and somehow it stopped working (maybe some windows update messed with something), device was always "offline" when using "adb devices". I've tried lots of different suggestions (reinstall drivers, disable/enable usb debug, adb kill/restart-server, change cable, change USB port, restart PC, restart phone, just revoke usb auth (see below) with no success.
Then I realized: what if I delete the RSA keys, and just then revoke the USB debug authorization? And finally, it worked!
Thanks to this website I've quickly found the location of the keys: Refresh Android Debug Bridge Keys.
On Windows, they are on folder C:\Users\{username}\.android\
After that, next time I plugged the phone and performed a "adb devices" finally, it showed "unauthorized" instead of "offline". Then on the phone screen there was a popup requesting authorization. Once authorized again, voila: everything working!
Since I didn't find this suggestion on any other forum before, I decided to post here my personal solution. Maybe I could help some other fellows with same issue.
Disable and re-enable adb debugging in your device's Developer options. Also, when you connect the device to your computer, you will get a prompt in the device asking if you want to trust the computer, Click ok.
try adb kill-server && adb start-server && adb devices
besides, this is no emulation, but debug on physical hardware.
one could also define this script as "external tool" in Android Studio.
This may be a late answer, but this is what worked for me.
When prompted on the computer to choose what happens when the device is plugged in, choose "Do Nothing" or simply ignore it.
On the Device, When asked "Allow Access to phone data?" tap AllOW.
This is what you should see when you swipe down from top.
In the options above, select charge this phone
wait for a few seconds and then again select either Transfer Files or Connect a MIDI Device
The device should show up in your list after some time.
If it doesn't, disable and then re-enable USB debugging from the developer options.

LG Device Android USB Driver Issue

I am using LG Optimus G. ADT shows that my device is offline and version is unknown as seen on the screenshot. I am sharing my device manager look also. It is installed but i think it is not properly working. I don't want to ignore that matter it is probably going to face me later.
Thanks.
1. First ensure that the device is set up properly for USB debugging. Check that
- you have installed the proper driver for your phone on your PC.
- you have enabled USB debugging in Developer Settings.
2. After you have done the first step, when you connect your phone to the PC, a dialog will popup on your phone prompting you to accept the computer's RSA key. Accept it and the device will be shown as online in your IDE.
3. As a last resort, you can try re-starting your IDE. This will force adb to start properly.

Enable USB debugging on Android

I am trying to enable USB Debugging on Android so that I don't need to use the emulator.
I did what all the posts all around the web say to do: I went to settings -> applications -> Developer -> USB debugging
It still does not turn on the notification sign that USB Debugging is enabled, and Eclipse does not recognize it, and uses the regular emulator.
Does anyone have any idea what is wrong?
You haven't specified what device you are using or what operating system you are using, so that could be helpful.
A few things to keep in mind:
1 Don't mount as USB storage.
2 You also need to make sure to install the drivers for your phone so that the Android Debug Bridge (ADB) can properly communicate. After these are installed, try the command "adb devices" and you should see an item in your list of devices.
Update based on your comment: You can download Kies from Samsung, which include the drivers (as well as other things): http://www.samsung.com/us/kies/
Or you can find unofficial driver-only packages, such as: http://forum.xda-developers.com/showthread.php?t=961956
I think you'll need the OEM USB dirvers.
Read this:
OEM USB Drivers
My experience with windows has been that you might need to un-install the USB drivers under device manager. Then disconnect the device (restart might be required). After plugging the device back in make sure you use the manufactures drivers if available
you have installed your device driver rite?then right click on your app name->run as->run configurations->target->select manual->apply.after that click on debug button then it will ask you to select the device.
If everything else is tested, try with another USB cable.
On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.
Fruthermore on some devices you will be asked to accept an RSA key, which allows debugging through your computer. This ensures that other adb commands cannot be executed unless you're able to unlock your device.
Detailed information can be found here:
http://developer.android.com/tools/help/adb.html It is the overview about adb commands (which is used to send data to your device) and it starts with the steps how to bring your phone to debug-mode.
I wish to add to Danation's answer with the following.
If you have installed KIES, and you've tried following instructions a couple of times (for the android SDK package) without success, here's what worked for me:
As a precaution, disconnect the device, and press 'Revoke USB Debugging authorizations'.
Now, go to kies, and reinstall the device driver as seen on the image below.
Connect the device.
For me, it was a routine, it usually works when installing kies, but I was stuck on this today for a little while, and I hope i can help others with my solution as well..

Categories

Resources