31

After update of Android Studio to 2.1.2 I've been getting the following error too many times when i make a change.

com.android.ddmlib.AdbCommandRejectedException: device offline

Error while Installing APK

The problem is device was never connected and is not offline

If i unplug and re-plug the device it starts working fine again. This never happened in the previous version of AS.

Question: Is there a setting to be changed in AS for this to stop happening or it is a bug?

Viral Patel
  • 32,418
  • 18
  • 82
  • 110

15 Answers15

24

Invalidate your Studio cache, restart your device and pc will work. Sometimes the problem with port also, just try after changing the usb port of your pc also.

Neo
  • 3,546
  • 1
  • 24
  • 31
8

Re-enabling USB Debugging fixed the problem

Settings > Developer Options > Disable & Re-enable USB Debugging

Merbin J Anselm
  • 1,014
  • 1
  • 13
  • 15
7

You just need to restart ADB , no need to restart your PC or Phone

Try the below steps:

Go to the Android SDK platform-tools directory in the command prompt

Type adb kill-server
Then type adb start-server

Now try re-connecting ...

It Worked!

In my case I was debugging over wifi for a long time , then the ADB server needed to be refreshed to see the connected devices again

It Happened on Pixel device running Android 8.1.0 with Android Studio 3.0

Cheers!

Community
  • 1
  • 1
Fahad
  • 1,943
  • 22
  • 27
  • I agreed, I just restarted adb.exe from windows task manager and started debugging on android studio. changing the USB port also may help – mili Jul 12 '18 at 15:01
2

Try Disabling and Re-Enabling * USB debugging. *

Under your developer option menu

This solved my issue.

Vicky Salunkhe
  • 9,869
  • 6
  • 42
  • 59
1

I have "revoked USB debugging authorizations " under "Developer options" and it works

Alessandro Caliaro
  • 5,623
  • 7
  • 27
  • 52
1

I changed settings in the Developer options in my phone and it started working just fine.

1.Permission to install apps from unknown source 2.permission to install apps via USB.

Karthik Golla
  • 11
  • 1
  • 3
1

Had Same Problem, Just rebooted and its fixed, its the connection problem actually, so check phone's cable first

Zubaer Haque
  • 172
  • 1
  • 9
0

In my case, I have activated Unknown sources in my cellphone to let application installation. Because the app hasn't accepted by Google yet, so it will block installation process.

To activate Unknown sources (In my device Samsung Galaxy Tab A 9.7 is):

Lock screen and security
Esmaeil MIRZAEE
  • 1,110
  • 11
  • 14
0

unplug your device and click on run and after visiting selection window, plug your device again and select your connected device. it will work!

Abolfazl Miadian
  • 3,099
  • 2
  • 19
  • 15
0

I have changed it from Charge The Device to File Transfer and it works every time.

Hunter
  • 3,080
  • 20
  • 23
0

Had the Same Problem .. Solved after restart My AS and My Device, Don't forget to check your Caple.

0

I got it solved for mac Android>Preferences>Build,Execution, Deployment>Debugger ---Uncheck => Use libusb backend

for windows File>Settings>Build,Execution, Deployment>Debugger ---Uncheck => Use libusb backend

0

Change USB port and use another USB port of your PC or Laptop. This works for me!

Mohammad Davari
  • 430
  • 3
  • 13
0
  1. restart and in validate android studio
  2. Disable and enable usb debugging
  3. unplug device
  4. plug device
  5. uninstall existing app
  6. kill and start adb server
  7. YourComputer@YourComputer:~/Android/Sdk/platform-tools$ adb kill-server
  8. YourComputer@YourComputer:~/Android/Sdk/platform-tools$ adb start-server
  • daemon not running; starting now at tcp:5037
  • daemon started successfully
  1. Run app again
  2. if it doesn't work ensure u cable or connection is good
FEELIX
  • 407
  • 4
  • 8
-2

Tools>>AVD Manager >>Actions >>Select you Device More >> Wipe Data

Start again Device

Rahul Agarwal
  • 4,034
  • 7
  • 27
  • 51