如何使用带API 23的adb在系统级禁用android设备/模拟器的动画?

如何使用带API 23的adb在系统级禁用android设备/模拟器的动画?,android,adb,Android,Adb,根据读取结果,需要将值window\u animation\u scale、transition\u animation\u scale和animator\u duration\u scale设置为0 以下适用于API 22,但不适用于API 23: adb shell settings put global window_animation_scale 0.0 甚至下面的命令也不适用于API 23 adb shell content update --uri content://settin

根据读取结果,需要将值
window\u animation\u scale
transition\u animation\u scale
animator\u duration\u scale
设置为0

以下适用于API 22,但不适用于API 23:

adb shell settings put global window_animation_scale 0.0
甚至下面的命令也不适用于API 23

adb shell content update --uri content://settings/system --bind value:s:0.0 --where 'name="window_animation_scale"'
我们只想禁用动画来防止视觉测试失败。 我们不希望在应用程序中引入此逻辑,因此希望在系统级别而不是通过应用程序应用它。

检查此Bash脚本

 adb shell update global set value='0.0' where name='window_animation_scale'
 adb shell update global set value='0.0' where name='transition_animation_scale'
 adb shell update global set value='0.0' where name='animator_duration_scale'

希望有帮助

您可以执行以下adb命令来禁用动画:

adb shell settings put global window_animation_scale 0
adb shell settings put global transition_animation_scale 0
adb shell settings put global animator_duration_scale 0
另外,你可以看看这个

构建项目并下载生成的.apk文件,然后按照项目中提到的说明禁用动画,之后您应该会一帆风顺。你也可以从很多其他来源下载相同的.apk文件(去谷歌吧!)

获得.apk文件后,发出以下命令:

 adb install -r android_emulator_hacks.apk
 adb shell pm grant no.finn.android_emulator_hacks android.permission.SET_ANIMATION_SCALE
 adb shell am start -n no.finn.android_emulator_hacks/no.finn.android_emulator_hacks.HackActivity

马克W的答案应该被接受 为了方便起见,您还可以将其另存为shell脚本,即:

#!/bin/sh
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
然后在终点站打电话

sh path/to/file.sh

或者更进一步,在bash配置文件中保存别名快捷方式:)

adb shell设置命令已经足够好了。只是为了使这些设置生效,您必须重新启动

解决方案的关键是在更改设置后重新启动
sudo重启
是你必须避免和接受的
$ANDROID\u HOME/platform tools/adb shell“su 0 am start-a ANDROID.intent.action.REBOOT”


我还就同一问题写了一篇文章。

为什么需要重新启动?如果我们只运行adb外壳设置,将其置于全局…我们可以立即观察结果。该命令的行为与转到“设备设置”并用轻触键执行相同。在API 24 emulator上尝试过。我无法评论“为什么”,但重新启动后设置似乎是正确的。什么是
su0上午开始…