React Native Android混合应用程序-启动应用程序后Detox挂起,开玩笑超时

时间:2019-01-29 21:17:05

标签: android react-native hybrid detox

我正在尝试在Hybrid React Native App中使用Detox。大多数应用已移至React,但仍在Android上显示某些屏幕。
问题:
当我在Android混合应用中运行排毒时,该应用会启动但立即关闭。

“ react-native”:“ ^ 0.57.8”,
“排毒”:“ ^ 10.0.5”,
“ jest”:“ ^ 24.0.0”

我在React Native应用中测试了相同的配置,并且可以正常工作。

我发现了这个问题,但是它已经关闭,没有任何变化:
https://github.com/wix/detox/issues/720

Android模拟器日志:

--------- beginning of crash
     

2019-01-30 11:17:00.862 5047-5081 /? E / AndroidRuntime:致命例外:com.wix.detox.manager       流程:com.example.ha.androidapp,PID:5047       java.lang.ClassCastException:android.app.Application无法转换为com.facebook.react.ReactApplication           在com.wix.detox.ReactNativeSupport.getInstanceManager(ReactNativeSupport.java:63)           在com.wix.detox.ReactNativeSupport.waitForReactNativeLoad(ReactNativeSupport.java:117)           在com.wix.detox.ReactNativeCompat.waitForReactNativeLoad(ReactNativeCompat.java:33)           在com.wix.detox.DetoxManager.start(DetoxManager.java:72)           在com.wix.detox.Detox $ 1 $ 1.run(Detox.java:133)           在android.os.Handler.handleCallback(Handler.java:751)           在android.os.Handler.dispatchMessage(Handler.java:95)           在android.os.Looper.loop(Looper.java:154)           在com.wix.detox.Detox $ 1.run(Detox.java:136)           在java.lang.Thread.run(Thread.java:761)

MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);
    mReactInstanceManager = ReactInstanceManager.builder()
            .setApplication(getApplication())
            .setBundleAssetName("index.android.bundle")
            .setJSMainModulePath("index")
            .addPackage(new MainReactPackage())
            .setUseDeveloperSupport(BuildConfig.DEBUG)
            .setInitialLifecycleState(LifecycleState.RESUMED)
            .build();
    mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);

    setContentView(mReactRootView);
}

0 个答案:

没有答案