Android Emulator "Allow USB Debugging" dialog close right after showing - android

I'm trying to debug with Android R in Pixel emulated devices w/ PlayServices but the "Allow USB Debugging" dialog instantly close right after showing, so I can't click in "Allow" to AS connect to the AVD. I went to Developer options in Android to switch off and on again the USB debugging, but again the dialog close imediatelly right after showing. I tried kill/star ADB and unistalling all AS/user configs/etc and reinstalling again but didn't solve. Anyone has a clue?

Seems like this issue is related to your emulator's API version, after some testing I found that Pixel 4 API 30 have your problem, while others don't.
Another odd thing about the box is that it will ask you again for permission when you start a new session, even though I clicked the "always allow this device" button.

Wipe data and it will pop up and stay. Check the "always allow debugging on this device" box and you should be good to go.

get your public key from ~/.android/adbkey.pub
append it to /data/misc/adb/adb_keys of emulator (create it if not exist)
restart emulator
then you should connect directly.
ref:
How to solve ADB device unauthorized in Android ADB host device?

Try remove files adbkey and adbkey.pub in:
~/.android/adbkey/ on Linux
%UserProfile%\.android on Windows
%ANDROID_SDK_HOME%\.android on Windows, if set
adb kill-server
adb devices
Restart the emulator after wiping its data. Then the permission for "USB Debugging" should be given and it should show up as debuggable device.
The problem should only appear with google_apis_playstore devices, see here. Reason I think is, that the key files are only copied by adb, if no other keys already exist on the emulator. So may deleting the files on the emulator may also work.

I had the same issue. I tried to click "Allow" in time, but it was too fast on my PC. However, I noticed that after a cold boot this popup pops and doesn't hide for some time (may be due to load lag), so I managed to click it this way.
If someone still has this problem and the goal is to upload some file or apk, better upload it to google drive and download it by link in the emulator.

This problem occurs with Pixel emulators on API level 30, so choosing 31 instead will solve the issue.

I solved this problem by following steps:
Wipe emulator data
Start emulator again
Above steps resulted in no dialog at all, weird, then I looked at the Android Studio, the emulator was already connected.

After some experiments I found that x86 apis were showing this error so simply switching to x86_64 apis solved the problem :

Related

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.

Emulator crashes and phone isn't recognized on Android Studio

I never had problems using Android Studio, while debugging directly on device or via emulator. Today after a long time, i tried to install it on my workstation and it looks like there are unidentified problems, that I didn't find anywhere on google ...
Emulator:
I tried 981234912849821 different settings but i can't start an emulation, it worked only ONE time. When i opened it again, it didn't work again D:
The emulator always starts, then crashes saying:
qemu-system-i386.exe has stopped working
I tried to use it with Graphics: Software - GLES 2.0 and this is the result:
I became bored about it, so i tried to directly use my phone and i discovered that android studio wasn't finding it, even by changing type of usb connection ...
Do you have any idea about this problem guys? ^^
PS: Don't flag it as duplicate, I already saw the answers on who has these problems but nothing worked for me :\
You need an ADB driver for your phone installed on your system. Also make sure that under the Developer Settings in Settings of your phone, USB Debugging is enabled.
Note: If you cannot find Developer Settings, just go to > Settings> About Phone> tap on Build Number for 7 times> then just go back to the settings and you'll see the Developer options.
And regarding the emulator, you might want to buff the resolution and the ram of the virtual device and try again.

Android Virtual Device/ Android Emulator - Decryption Unsuccessful

I just installed Android Studio, and I am very new with this program.
So when I run the Android Emulator it says: "To Start Android, enter your password", although I have never set a password. When I just enter a word with 4 letters it says "The Password you entered is correct, but unfortunately your data is corrupt".
After that, I have to Reset the Phone, but when I do that the same menu with "To Start Android, enter your password" appears.
Maybe it is just an easy mistake, but as I said I am new with this. I also did some research on the internet but I did not find anything useful.
this is the 2 images that it showe me:
1)
2)
and after i clicked on reset phone, nothing happened.
I would be very glad if someone has an answer for this.
This is a late response, but thought this simple fix might help anyone else who comes across this problem in the future. What worked for me is the following:
In VS2017 ==> Tools ==> Android ==> Select: Android Device Manager
In the Android Device Manager window, you'll see your Android Emulator.
Make sure the far right column contains the button "Start" (if "Stop" appears, click "Stop")
Right Click the device, and select the "Factory Reset" option in the menu.
Your emulator should now be working. Good luck.
open AVD and right click on the emulator choose ->Wipe data option.
Check that your avd folder path doesn't include national symbols (in my case it looked like C:\Users\Пользователь\.android).
After I changed this path everything is working.
See this post of how to change path:
Possible to change where Android Virtual Devices are saved?
Check out "Viewing and managing your Avds" part. Try wiping data of your emulator or create a new emulator for yourself.
https://developer.android.com/studio/run/managing-avds.html
enable GoogleAPIs and Google Play Store
Change the Android version. I was creating an emulator with Oreo 8.1 and got stuck in with the same issue.
I created another with Marshmallows 6.0 and no more asking for password.
Then if you are using Oreo 8.1 try with antoher.
I created a virtual device, and after, I had to reinstall the emulator.
When I booted the virtual device, I got this issue.
I deleted it and made a new one, and it worked fine.
Just go the AVD Manager and Wipe Data. The problem will be solved.
Here are the steps I followed after my device corrupted.
Close your emulator
Open AVD manager, right click on your device and click "Cold Boot Now" button.
Sorry for a very Late Answer. But you can't create a x64 Virtual Device on x64 System. Your device needs to be x86.
Just a warning to anyone getting this error on an emulator instance that was working and you cold booted or something. I got this error and just stopped and cold booted again and it was gone! So try that first before wiping your emulator instance unnecessarily.
Deleted the device in the Device Manager and created a new one with a higher OS version (Oreo -> Pie). The error disappeared. Did not find the real reason yet.

Android Studio 2.1.1: "no usb devices or running emulators detected"

Suddenly my Android Studio stopped detecting all my devices, none of them is working. It happen from one execution to another. I've changed a few lines of code (1 min maybe?), hit run (instant run) and then I missed all my devices.
I'm using a Mac and as devices: Nexus 5x, Galaxy s6 and Oneplus One. What can be happening? I've checked previous questions here and tried all this:
Run configurations: no matter if I chose usb device or show the window, it does not work.
Tools > Android > Enable ADB integration: didn't help
Command line adb devices does not detect any either.
I've revoked and granted again USB authorizations. Still not working.
I've tried other apps I have, none work.
Restarted phones
Restarted android studio
Restarted computer
(Note: if I start an emulator it works, but I'd prefer to use physical device since I have to scan real barcodes)
Thanks a lot in advance.
On Lollipop 5.1
Go to About Phone
Click 7 times on Build Number. Now Developer options are enabled
Go back and Click Developer options
Enable USB debugging under Debugging.
Well, I've fixed. The problem in case any faces the same was a Stetho (http://facebook.github.io/stetho/) tab in chrome, the one you open by typing: chrome://inspect/#devices not sure about the reason because it's been open for 2 days now, but it was the cause, once I closed it, it worked.
Found this unaccepted answer here: macbook adb cannot open interface That for sure should be accepted.
EDIT: I've been able to replicate the problem. It happens when you have the devices tab open and try to run a second app that has stetho configured.
It happens if your device drivers not installed Please do this.
In Case of PC
Right click my computer select manage select device manager from left panel if your phone drivers not installed there will be yellow alert on driver right click on it select update driver software then select search automatically for update driver software.
Other
Please install the missing drivers of your phone.
I had the same problem . What I've done to solve it going to Setting >> Additional Setting >> Developer Option
Now select:
Developer option on
USB debugging on
Install via USB on
USB setting security on
Verify apps over USB
OK, what finally worked for me was to go into Settings\Developer options\Select USB Configuration and change it to PTP or MIDI....either one of those worked for me and all of the sudden my phone showed up and I was able to see and run my test app on my android phone.
This woorked for me
Go To Settings
Developer Options
Enable USB Debugging
Enable Verify Apps over USB
Select USB Configuration: Choose MIDI
I hope it also works for you

After upgrade Android on Nexus to 4.2.2, Eclipse shows target unknown for device?

I just upgraded my phone to 4.2.2, but now i cannot use it in eclipse anymore.
I tried rebooting the device, reset my debug-settings but I cannot get it to work anymore.
I saw it is already a registered issue. There are some new security enhancements, so there should be a dialog (see here at bottom) but this dialog doesn't appear. I don't have several accounts on the phone, which is pointed out in the issue..
Anyone any suggestions?
EDIT: Look at accepted answer below, this should cover all cases. In my case, there were some packages missing, which weren't shown in the Android SDK Manager. I just found the Packages -> Reload in the Android SDK Manager... And I thought this happens automatically
You need three things in order to make sure this update goes smoothly:
Make sure your device is actually running 4.2.2 and the problem is not something else
Your SDK is updated to the latest tools. The adb binary in all but the latest version does not support the 4.2.2 security enhancements.
You are on the main account of your device in case of multiple user accounts.
Connect your Device to your computer and execute adb devices (make sure USB debugging is enabled). You should see something like this:
3tiu52839ry082j3 offline
Right about now, there should be a dialog on your device that looks something like:
Check the Always allow from this computer box if you want and click OK.
That's about it.
Some other things to check:
Make sure your USB cable isn't broken. Sometimes, the smaller cables break inside the main one, and your device may charge but have no data connection. Try with a different cable, or try accessing files on the device over USB (this will go fine if your cable is fine)
Make sure you're using the newest version of adb. Even after I updated my SDK tools, I couldn't get my device authorized when using adb. I eventually figured out that the Nvidia install of the NDK and SDK tools had updated my PATH variable to use the adb from that install, which wasn't the latest update. By using the adb in my newly updated install, I was able to get it all working.
For me it was solved by changing Nexus 7 tablet to "Camera(PTP)" mode.
Check out this blog post on how to do it.
After USB connection of Nexus 7 and confirming digest on Nexus 7, also connecting through TCP/IP with ADB worked.
Wierdly, unchecking and rechecking the "Allow USB Debugging" option popped me the window and selecting "ok" solved my problem.
If none of the solutions worked for you then Reset ADB.
Go to Devices ---Click the right most down arrow----Select Reset ADB from the list.
I had tried everything suggested here and suggested in every log/blog that I could find in google, but still no go. The USB cable is known to be good. ADB is version 1.0.31 (as shown with , USB Debugging is enabled in the Nexus 7 tablet, the SDK was updated to the very latest tools as available on 1-mar-2013 for 4.2.2/API 17. I had tried both Media and Camera modes for USB, rebooted windows, rebooted device over and over again, re-installed latest google USB driver, etc. etc. but ADB Devices still showed nothing.
I hard reset the Nexus 7 tablet thinking that maybe the screen to allow usb debugging had appeared but got hit with cancel. But that didn't work either.
What finally worked was:
going into windows control panel | Device Manager,
selecting NEXUS under Portable devices,
then in the Driver tab clicking on update and manually selecting the Google USB driver (the check feature said it was up to date). Previously, the date shown was in 2006, afterwards a date in 2012 (but more on this in a moment).
That didn't fix anything though.
So then I switched USB from MEDIA device to Camera device - THEN it wanted to install driver software, so I let it do that. Afterwards, I noticed that the driver for the Nexus was back with the 2006 version, BUT then ADB DEVICES FINALLY SHOWED OFFLINE!!!! HALLELUJAH AND the Nexus was displaying the Dialog to allow USB debugging, and it now all works.
What I am not sure of is what step actually solved the problem. I don't think it was necessary to hard reset the Tablet, but the fiddling with the device driver wasn't a very convincing solution either - I don't think the driver was corrupt - but maybe it had to be changed to get the right driver associated with the tablet when connected as a Camera Device. In any event, it is necessary to connect the tablet as a Camera device for ADB to work...
Restarting device or enabling USB debugging did not solve my problem.
However I changed USB PC Connection to "Camera(PTP)" mode and adb devices showed the device id of the phone.
After reading a lot post talking about this particular problem, I actually solved it by resetting user permissions on files (that were owned by root): ${HOME}/.android/adbkey and ${HOME}/.android/adbkey.pub
Go to Device Manager and uninstall your device and remove from USB
HAve you CMD opend and make sure you are at least in ADB Help.
Connect device to USB and continue with steps provided by Raghav Sood - few answers ahead of me.
Worked for me just fine
I tried with this custom build and it works for me. Now I can see my logcat in Eclipse again.
https://github.com/khaledev/ADT/releases
Download the zip file then in Eclipse menu Help > Install New Software... > Add > Archive... Just pick the downloaded zip and do the rest of the install process.

Categories

Resources