无法解析活动:意向意向

由网友(奋不顾身)分享简介:我有在运行Android单元测试的一个问题。我得到这个错误,当我试图运行一个简单的测试。 I am having a problem in running Android unit test. I got this error when I tried to run a simple test. 下面是日志:块引...

我有在运行Android单元测试的一个问题。我得到这个错误,当我试图运行一个简单的测试。

I am having a problem in running Android unit test. I got this error when I tried to run a simple test.

下面是日志:

块引用   java.lang.RuntimeException的:无法解析的活动:意向{行为= android.intent.action.MAIN FLG = 0x10000000处CMP = com.wsandroid.Activities / .SplashActivity}   在android.app.Instrumentation.startActivitySync(Instrumentation.java:371)   在android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:120)   在android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:98)   在android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:87)   在com.wsandroid.test.activity.TestEULA.setUp(TestEULA.java:15)   在android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)   在android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)   在android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)   在android.app.Instrumentation $ InstrumentationThread.run(Instrumentation.java:1447)

Blockquote java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=com.wsandroid.Activities/.SplashActivity } at android.app.Instrumentation.startActivitySync(Instrumentation.java:371) at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:120) at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:98) at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:87) at com.wsandroid.test.activity.TestEULA.setUp(TestEULA.java:15) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)

此错误发生为Android小于2.2。它工作正常,为Android 2.2模拟器。然而,Android 2.2的模拟器有,即使我们只有preSS是1发送键两次的错误。应用程序将在Android 2.2平台上测试运行。

This error occurs for Android less than 2.2. It works fine for Android 2.2 emulator. Yet Android 2.2 emulator has a bug of sending a key twice even though we only press it one. Application to be tested runs on Android 2.2 platform.

鸭preciate如果你们任何人都可以帮助我。

Appreciate if anyone of you can help me.

Dzung。

推荐答案

我也有类似的问题,一个简单的测试项目为一个应用程序,只是一个启动画面。我发现,我已经实现了构造错误的。我最初的构造函数的执行情况是这样的......

I had a similar problem with a simple test project for an app that was just a splash screen. I found that I had implemented the constructor wrong. My initial implementation of the constructor was this...

public SplashScreenTest(){
    super("com.mycomp.myapp.SplashScreen", SplashScreen.class);
}

在一些打我的头撞在墙上,我莫名其妙地决定从超的PKG参数除去闪屏()。我的成功实施是现在这个样子......

After some beating my head against the wall, I somehow decided to remove the SplashScreen from the pkg argument of super(). My successful implementation is now like this...

public SplashScreenTest() {
    super("com.mycomp.myapp", SplashScreen.class);
}

我希望这可以帮助你或其他人解决问题。

I hope that this helps you or others solve the problem.

阅读全文

相关推荐

最新文章