gpt4 book ai didi

android - Espresso 不适用于 NineOldAndroids 动画?

转载 作者:太空宇宙 更新时间:2023-11-03 13:25:06 24 4
gpt4 key购买 nike

我正在尝试使用 Espresso 测试我的 Activity (HomeActivity),它具有基于 NineOldAndroids 库的重复动画。我按照描述关闭了系统动画 here , 但它没有帮助,我收到一个错误(见下文)。唯一有帮助的是手动删除动画。所以问题是我是否需要手动关闭动画(使用 BuildConfig 似乎没有麻烦)或者我做错了什么?提前致谢!

 java.lang.RuntimeException: Could not launch intent Intent {
act=android.intent.action.MAIN flg=0x14000000
cmp=com.package.en/com.package.ui.HomeActivity } within 45 seconds.
Perhaps the main thread has not gone idle within a reasonable amount
of time? There could be an animation or something constantly
repainting the screen. Or the activity is doing network calls on
creation? See the threaddump logs. For your reference the last time
the event queue was idle before your activity launch request was
1392052899081 and and now the last time the queue went idle was:
1392052899081. If these numbers are the same your activity might be hogging the event
queue.

最佳答案

问题修复:

    @Before
public void setUp() throws Exception {
super.setUp();
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
Intent intent = getIntent();
if (intent == null) {
intent = new Intent();
}
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
setActivityIntent(intent);
}

@SuppressLint("NewApi")
@Override
public T getActivity() {
final T activity = super.getActivity();
activity.overridePendingTransition(0, 0);
return activity;
}

关于android - Espresso 不适用于 NineOldAndroids 动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21697029/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com