我更新了Android API,Travis将在其上运行从API 22到API 24的测试,从那时起我就无法再运行测试了。我继续为我的所有测试得到这个错误输出:
com.simplemobiletools.calculator.MainActivityTest > divisionByZeroTest[test(AVD) - 7.0] FAILED
java.lang.RuntimeException: Waited for the root of the view hierarchy to have window focus and not request layout for 10 seconds. If you specified a non default root matcher, it may be picking a root that never takes focus. Root:
Root{application-window-token=android.view.ViewRootImpl$W@2409854, window-token=android.view.ViewRootImpl$W@2409854, has-window-focus=false, layout-params-type=1, layout-params-string=WM.LayoutParams{(0,0)(fillxfill) sim=#100 ty=1 fl=#81810100 pfl=0x20000 wanim=0x1030465 needsMenuKey=2}, decor-view-string=DecorView{id=-1, visibility=VISIBLE, width=480, height=800, has-focus=true, has-focusable=true, has-window-focus=false, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=WM.LayoutParams{(0,0)(fillxfill) sim=#100 ty=1 fl=#81810100 pfl=0x20000 wanim=0x1030465 needsMenuKey=2}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=2}}
这是我的travis.yml看起来像这样:
{
"sudo": false,
"language": "android",
"android": {
"components": [
"tools",
"platform-tools",
"build-tools-27.0.2",
"android-27",
"android-24",
"sys-img-armeabi-v7a-android-24",
"add-on",
"extra"
]
},
"licenses": [
"android-sdk-license-.+"
],
"jdk": "oraclejdk8",
"before_install": [
"echo yes | sdkmanager \"platforms;android-27\" \"build-tools;27.0.2\""
],
"before_script": [
"echo no | android create avd --force -n test -t android-24 --abi armeabi-v7a",
"emulator -avd test -no-window &",
"android-wait-for-emulator",
"adb shell input keyevent 82 &"
],
"os": "linux",
"group": "stable",
"dist": "trusty"
}
我尝试在模拟器行上添加/删除-no-skin和-no-audio标签,但没有成功。我可以暗示我在这里做错了什么吗?干杯!