排毒+;对本机Android启动做出反应,以显示空白屏幕 问题
虽然我的react原生android Detock build在iOS上运行良好,但当通过Detock cli打开时,它会启动一个空白屏幕 在这种状态下,无论是排毒+;对本机Android启动做出反应,以显示空白屏幕 问题,android,react-native,detox,Android,React Native,Detox,虽然我的react原生android Detock build在iOS上运行良好,但当通过Detock cli打开时,它会启动一个空白屏幕 在这种状态下,无论是cmd+m还是rr重新加载,都不值得一提 Package.json 故障排除 跑步时 detox test -c android.emu.debug --loglevel verbose 安卓apk可以安装、启动,但会被困在一个空白屏幕上 解毒原木 2分钟后 detox verb Instrumentation stdout: INS
cmd+m
还是rr
重新加载,都不值得一提
Package.json
故障排除
跑步时
detox test -c android.emu.debug --loglevel verbose
安卓apk可以安装、启动,但会被困在一个空白屏幕上
解毒原木
2分钟后
detox verb Instrumentation stdout: INSTRUMENTATION_CODE: 0
detox verb Instrumentation stdout:
detox verb instrumentationProcess terminated due to receipt of signal null
1) "before all" hook: _callee
0 passing (2m)
1 failing
1) "before all" hook: _callee:
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
0 passing (2m)
1 failing
1) "before all" hook: _callee:
Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
Android日志
从运行react-native-log-android
01-17 15:11:01.053 5248 5318 D ReactNative: Initializing React Xplat Bridge.
01-17 15:11:01.055 5248 5318 D ReactNative: Initializing React Xplat Bridge before initializeBridge
01-17 15:11:01.060 5248 5318 D ReactNative: Initializing React Xplat Bridge after initializeBridge
01-17 15:11:01.061 5248 5318 D ReactNative: CatalystInstanceImpl.runJSBundle()
01-17 15:11:01.061 5248 5323 D ReactNative: ReactInstanceManager.setupReactContext()
01-17 15:11:01.061 5248 5323 D ReactNative: CatalystInstanceImpl.initialize()
01-17 15:11:01.065 5248 5323 D ReactNative: ReactInstanceManager.attachRootViewToInstance()
仿真器行为
在上面的日志之后的某个时候,应用程序将超时,所以我将其杀死。当我从emulator启动相同的应用程序(由detox安装的相同apk)时,它会按预期工作
当apk按预期启动时,react native log android
中的日志会有额外的一行
01-17 15:24:10.207 6447 6530 I ReactNativeJS: Running application "MyApp" with appParams: {"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
在这一点上,我知道apk是好的,所以我尝试了--reuse
标志,但同样的问题
java测试
package com.mypackage.mobile;
导入android.support.test.filters.LargeTest;
导入android.support.test.rule.ActivityTestRule;
导入android.support.test.runner.AndroidJUnit4;
进口com.wix.detox.detox;
导入org.junit.Rule;
导入org.junit.Test;
导入org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
@最大的
公开课排毒测试{
@统治
public ActivityTestRule mActivityRule=新的ActivityTestRule(MainActivity.class,false,false);
@试验
public void runDetoxTests()引发InterruptedException{
排毒。跑步测试(麦迪律);
}
}
问题:
是否有人知道如何解决它,这样,当通过Detox CLI运行时,应用程序会像预期的那样启动,而不是我所得到的空白屏幕。如果没有的话,我是否可以采取下一个好的步骤,从DetoxTest.java启动应用程序 如果应用程序没有启动,那么Android应用程序很可能无法正常构建。你能确保你的“android.emu.debug”在你的
package.json
中正确地嵌套在detox.configurations下吗
"detox": {
"configurations": {
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
},
}
}
另外,检查并确保您的android/app/build.gradle中有以下内容
androidTestImplementation(project(path: ":detox"))
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
我在Android上也有类似的问题。帮助我的部分原因是使用了这个:
beforeAll(() => {
device.reloadReactNative();
});
此外,我在运行测试之前打开了emulator进行测试Im仅在生产发布模式下存在同样的问题。找到解决办法了吗?@AlexHarrison虽然我已经好几年没有使用detox了,但我相当确定,在一个公司代理的背后有一些网络呼叫从未完成加载,detox正在等待它们在引擎盖下完成。一旦我们解决了这个问题,我们就能够向前迈进。虽然我们的用例可能会有所不同,但要知道,如果detox认为应用程序正在做一些事情,它会等待。
"detox": {
"configurations": {
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Nexus_5X_API_26"
},
}
}
androidTestImplementation(project(path: ":detox"))
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
beforeAll(() => {
device.reloadReactNative();
});