gpt4 book ai didi

带有 Facebook SDK 的 Android Espresso AppNotIdleException

转载 作者:行者123 更新时间:2023-12-04 13:41:43 24 4
gpt4 key购买 nike

当我在 list 中添加 Facebook SDK 和 applicationId 时,Espresso 测试不起作用
如果类中有多个测试方法,则错误仅发生在第一个测试中

 <meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />

导致 AppNotIdleException 异常
E/TestRunner: androidx.test.espresso.AppNotIdleException: Looped for 2 iterations over 60 SECONDS. The following Idle Conditions failed .
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
at java.lang.Thread.getStackTrace(Thread.java:1538)
at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:94)
at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:57)
at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:316)
at androidx.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:177)
at androidx.test.espresso.ViewInteraction.perform(ViewInteraction.java:118)

如果我删除 com.facebook.sdk.ApplicationId从 list 中测试正常运行

安卓测试版本:
ext {
kotlin_version = '1.3.31'
koin_version = '2.0.0-rc-2'
nav_version = '2.0.0'
arch_version = '2.0.1'
retrofit_version = '2.5.0'
lifecycle_version = '2.0.0'
glide_version = '4.9.0'
espresso_version = '3.1.1'
}
//  Facebook
implementation 'com.facebook.android:facebook-login:4.42.0'

// Android test
androidTestImplementation "androidx.arch.core:core-testing:$lifecycle_version"
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espresso_version"
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation "org.koin:koin-test:$koin_version"
androidTestImplementation "org.mockito:mockito-android:2.25.0"
androidTestImplementation 'com.squareup.okhttp3:mockwebserver:3.14.1'

// Unit test
testImplementation 'junit:junit:4.12'
testImplementation "androidx.test:core:1.1.0"
testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
testImplementation "org.koin:koin-test:$koin_version"
testImplementation "org.mockito:mockito-core:2.27.0"
testImplementation 'com.squareup.okhttp3:mockwebserver:3.14.1'

最佳答案

我遇到了同样的问题并通过将其放入我的 AndroidManifest.xml 来解决它:

<application ...>
<meta-data android:name="com.facebook.sdk.AutoInitEnabled" android:value="false"/>
</application>
附加信息: FB GDPR Compliance

关于带有 Facebook SDK 的 Android Espresso AppNotIdleException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56112009/

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