AdbCommandRejectedException getting properties whe

2019-02-12 01:55发布

It's getting really frustrating to test any apps at all. I start up the emulator and run the app the first time and it works and immediately starts throwing this in the ADB Logs

DeviceMonitor: Failed to connect to client '2560': EOF
PropertyFetcher: AdbCommandRejectedException getting properties for device emulator-5554: device offline

Logcat displays nothing. I've tried everything to stop this. Killing and starting the adb server does not solve the problem. I have to restart the AVD.

Any help will be appreciated. Thanks

6条回答
ゆ 、 Hurt°
2楼-- · 2019-02-12 02:22

This usually happens because android emulator is just to slow and adb command times out. But you have parameter that you can set to increase this timeouts.

If you are running adb commands through gradle. For example connnectedCheck. You can use android plugin DSL to set this parameter as shown blow

android {
    adbOptions {
        timeOutInMs 60000 // set timeout to 1 minute
    }
}

This was added in android gradle plugin 1.2.0. Unfortunately it only works if you have multidex enabled. For some reason they forgot to include it for single apk builds. But there is a workaround to handle this. You can just call static method as show below.

com.android.ddmlib.DdmPreferences.setTimeOut(60000)

If you are running adb commands directly with adb you have an option to set environment variable that will handle this.

export ADB_INSTALL_TIMEOUT=5

Keep in mind that ADB_INSTALL_TIMEOUT is set in seconds and not in milliseconds as in gradle DSL.

查看更多
手持菜刀,她持情操
3楼-- · 2019-02-12 02:31

The USB cable connecting the phone to your PC affects the adb devices offline/device status. Try replacing the cable with a known working one.

查看更多
Rolldiameter
4楼-- · 2019-02-12 02:40

I faced similar issue, and I run

adb devices

in Terminal and my device is showing offline I restarted the device it started working for me. But you you are frequently getting this issue the restart is not a good solution.

查看更多
祖国的老花朵
5楼-- · 2019-02-12 02:42

It happened to me with a real device.

Try revoking USB debugging authorizations (from device Settings->Developer options). Then reconnect the device and give the authorization.

查看更多
We Are One
6楼-- · 2019-02-12 02:47

Try with this i hope it will help you.

1-adb kill-server
2-adb start-server to restart the adb.
It can be found in your android sdk directory, subfolder plattform-tools.
or
Try to locking and unlocking your emulator by clicking F7 and Check the logcat when you do this.

查看更多
▲ chillily
7楼-- · 2019-02-12 02:49

My advice to anyone using the Emulator is to get off AVD. Get a real device or download Genymotion. The free version gets the Job done.

查看更多
登录 后发表回答