|
我用Robotium进行Android测试,测试工程中配置文件的android:targetPackage到底配置哪个包呢?有人说应该跟<manifest>中package的值相同,但我改成相同的时候会报错啊,像下面这种错误找不到类。大神们能不能告诉我这项配置到底是什么原理啊,为什么同样的配置方法有的测试项目能运行成功,有的会报错呢?
java.lang.RuntimeException: Exception during suite construction
at android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstructionFailed(TestSuiteBuilder.java:236)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1886)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.test.suitebuilder.TestMethod.instantiateTest(TestMethod.java:87)
at android.test.suitebuilder.TestMethod.createTest(TestMethod.java:73)
at android.test.suitebuilder.TestSuiteBuilder.addTest(TestSuiteBuilder.java:260)
at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:182)
at android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:380)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4717)
at android.app.ActivityThread.access$1600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5438)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/example/texthello2/MainActivity;
at com.example.texthello.test.test1.<init>(test1.java:19)
... 15 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.texthello2.MainActivity" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.example.texthello.test-1/base.apk", zip file "/data/app/com.example.texthello.test-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.texthello.test-1/lib/arm, /data/app/com.example.texthello.test-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
... 16 more
Suppressed: java.lang.ClassNotFoundException: com.example.texthello2.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
|
|