19

I'm trying to test my app against the Android O developer preview. I can download and run the emulator, but when deploying my app, it always comes up as "[OFFLINE]". If I go ahead and try to deploy anyway, I get the following output:

com.android.ddmlib.AdbCommandRejectedException: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.
Error while Installing APK

I've tried restarting ADB as suggested in the output above. Also, I never get a confirmation dialog in the emulator. Emulators for other versions. eg. Nougat 7.1 work fine.

I'm running Android Studio 3.0 Canary 1 (the standard channel doesn't work either).

Glenn Porter
  • 536
  • 6
  • 18
  • https://stackoverflow.com/a/25546300/940834 See if this link helps. I know you have an emulator, but most of the steps probably still apply – Mcloving May 30 '17 at 11:02
  • 1
    Thanks, @Mcloving. Tried those steps but it never asked me to confirm the connection (step 4) and sadly the device remains unauthorised when running adb devices. Thanks though! – Glenn Porter May 30 '17 at 11:17
  • 1
    Looks like the issue persists even in the current (non-preview) emulator version of Android O – Danny Sep 20 '17 at 13:18

2 Answers2

9

I've been searching for an answer to this issue, but finally worked it out for myself.

Emulators with "Play Store" enabled are the closest they've ever been to being a real device - including now having to enable Developer Options and then USB debugging to be able to deploy to it. If you don't do this, it shows as being an offline device with unknown capabilities.

https://developer.android.com/studio/debug/dev-options.html

Once the USB debugging option is enabled and the source device is approved, it all springs to life.

Darren Taft
  • 198
  • 1
  • 8
  • 7
    I've enabled the Developer Options, but I never get prompted to authorize the computer in the emulator, like I would on a real device when I plug the USB cable. How do I trigger that? Thanks! – Eric Sellin Sep 05 '17 at 15:58
  • @EricSellin Did you also enable USB Debugging on the Developer Options screen? It defaults to being turned off. – Darren Taft Sep 06 '17 at 16:23
  • I enabled USB Debugging but it still offline – Fayçal Sep 18 '17 at 20:39
  • did this get fixed? I also have this problem. – Adib Faramarzi Sep 26 '17 at 06:06
  • same problem here – Henri L. Oct 09 '17 at 14:02
  • 6
    Worked for me for an API 24 with Google Play emulator. When I enable "USB debugging" I get a screen asking me to "Allow USB debugging" (similar to [this](https://img.gadgethacks.com/img/03/28/63567129878697/0/android-basics-enable-developer-options-usb-debugging.w1456.jpg)). In an API 26 with Google Play emulator, when I enable USB Debugging the "Allow USB debugging" screen doesn't appear. – Yeray Oct 18 '17 at 09:03
4

I was getting this same error. I could not get it to work until I did the following steps.
Take a look at the AVD listing and I'll try to explain what I mean. oreo atom

The blue highlighted one is the one that I got working. However, the last one shown is the first one I attempted to get running -- notice that little briefcase icon? That means that it includes Google Play and that may be the issue.

When you set up your Oreo emulator the first screen will look something like the following --- choose a device without the briefcase (no google play). no briefcase - no google play

After that, you'll need to choose the Oreo image. It'll look something like the following and you may have a Download link if you don't already have it downloaded. I had already installed an Oreo image previously, but then it made me download this one too, which I thought was odd:

oreo 8.0

After that, you'll start up the image and I believe it will work with no problems just like your other emulators. I didn't have to do any of the developer setup on the device (did not have to turn on usb debugging or anything). It just worked.

I tried running the Oreo with Google Play again -- after the successful one above and even though it is running I still see it is offline. I'm actually running both emulators at the same time so you can see them listed on the right. offline

Also, I notice that every time I start the Google Play Oreo image it thinks it needs to set up the SD card and format it again so maybe their are other issues with that image.

raddevus
  • 8,142
  • 7
  • 66
  • 87
  • 1
    thanks for providing this really detailed answer on this. I haven't went back to this in a while as I ended up getting a Nexus 5X on the developer preview (and now the production build). However, I downloaded and ran the Oreo Google Play emulator today and I was able to deploy to it with no problems or making any changes. Looks like the problem is sorted thankfully! – Glenn Porter Oct 10 '17 at 15:36