Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:测试运行失败:由于';java.lang.ClassNotFoundException_Android_Eclipse_Android Manifest_Automated Tests_Robotium - Fatal编程技术网

Android 错误:测试运行失败:由于';java.lang.ClassNotFoundException

Android 错误:测试运行失败:由于';java.lang.ClassNotFoundException,android,eclipse,android-manifest,automated-tests,robotium,Android,Eclipse,Android Manifest,Automated Tests,Robotium,我试图在eclipse中运行简单的testcase,但我遇到了下一个错误: Android Launch! adb is running normally. Performing android.test.InstrumentationTestRunner JUnit launch Application already deployed. No need to reinstall. Launching instrumentation android.test.InstrumentationTe

我试图在eclipse中运行简单的testcase,但我遇到了下一个错误:

Android Launch!
adb is running normally.
Performing android.test.InstrumentationTestRunner JUnit launch
Application already deployed. No need to reinstall.
Launching instrumentation android.test.InstrumentationTestRunner on emulator-5554
Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
包括Robotium lib。Apk文件已退出并安装。 测试类的名称为“TestClass.java”。包名称-com.android.opera.test

apk-com.opera.browser的主要活动和程序包名称

我在这里读了所有类似的答案,但任何答案都不能解决我的问题。 代码:

package com.android.opera.test;
导入com.jayway.android.robotium.solo.solo;
导入android.test.ActivityInstrumentationTestCase2;
@抑制警告(“原始类型”)
公共类TestClass扩展了ActivityInstrumentationTestCase2{
私有静态最终字符串TARGET\u PACKAGE\u ID=“com.opera.browser”;
私有静态最终字符串启动器\u活动\u完整\u CLASSNAME=“com.opera.browser.com.opera.browser”;
私有静态类启动器ActivityClass;
私人独奏;
静止的{
试一试{
launcherActivityClass=Class.forName(LAUNCHER\u ACTIVITY\u FULL\u CLASSNAME);
}catch(classnotfounde异常){
System.out.println(e.getStackTrace());
抛出新的运行时异常(e);
}
}
@抑制警告(“未选中”)
public TestClass()抛出ClassNotFoundException
{
super(TARGET\u PACKAGE\u ID,launcherActivityClass);
}   
@凌驾
受保护的void setUp()引发异常{
super.setUp();
solo=新的solo(getInstrumentation(),getActivity());
}
public void testCaseTakeScreenshot()引发InterruptedException{
截图(“D://screenTest22!!!!.jpg”);
独奏。点击屏幕(50,50);
}
@凌驾
public void tearDown()引发异常
{
solo.finishOpenedActivities();
}
}
清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.opera.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" />

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.opera.browser" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="android.test.runner" />
    </application>

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

</manifest>

有人能帮我吗

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.opera.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" />

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.opera.browser" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="android.test.runner" />
    </application>

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

</manifest>