Adbcommandrejectedexception Getting Properties When Testing On Emulator
Solution 1:
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 // settimeout 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.
Solution 2:
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.
Solution 3:
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.
Solution 4:
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.
Solution 5:
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.
Post a Comment for "Adbcommandrejectedexception Getting Properties When Testing On Emulator"