问题
I have a warning when running React Native on an Android device:
Debugger and device times had drifted by more than 60s. Please correct this by running
adb shell "date `date +%m%d%H%M%Y.%S`"
on your debugger machine
But when I run the command as suggested above, I get and operation not permitted error:
date: cannot set date: Operation not permitted
I already tried with sudo, still got same result:
sudo adb shell "date `date +%m%d%H%M%Y.%S`"
回答1:
Inside the emulator goto Settings > Date & Time
- Deselect Automatic timezone.
- Adjust your timezone manually.
- Deselect automatic date & time and set correct time
回答2:
Deselecting automatic time and time zone did not work for me. Instead, I did adb shell su root date $(date +%m%d%H%M%Y.%S)
.
Adding "su root" is the solution to the "Operation not permitted" error.
Note that this is not equivalent to executing adb shell
first and then su root date $(date +%m%d%H%M%Y.%S)
(in this case $(date +%m%d%H%M%Y.%S)
returns the emulator time, which is not correct, so even though the command succeeds, it does not fix the problem).
回答3:
I had this problem in real android device, I had a time difference between the pc and the mobile higher than 60 second. I solve the issue just by putting them on same time
回答4:
I had this problem and solved it by enabling 'set time automatically' in windows 10 Time and Language settings. also I enabled automatic date & time in my android phone.
回答5:
If your phone can run adb
as root you can use the following commands:
>>> adb root
restarting adbd as root
>>> adb shell "date `date +%m%d%H%M%Y.%S`"
Mon Aug 26 21:04:24 +0430 201
来源:https://stackoverflow.com/questions/38938791/cannot-run-adb-shell-date-date-mdhmy-s