如何正确使用android.test.ServiceTestCase? [英] how to correctly use android.test.ServiceTestCase?
本文介绍了如何正确使用android.test.ServiceTestCase?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用程序是,在/系统/应用程序
My app is a Service that runs in /system/app
com.abc.def.MyApp
试图为它编写单元测试,我在logcat中得到这个错误运行时。
Trying to write unit tests for it, I get this error in the logcat while running.
I/TestGrouping( 5647): TestCase class com.abc.def.test.MyAppTest is missing a public constructor with no parameters or a single String parameter - skipping
命令一起使用:
D:\tmp_install>adb shell am instrument -w com.abc.def.test/android.test.InstrumentationTestRunner
WARNING: linker: memtrack.jacinto6.so: unused DT entry: type 0xf arg 0x115
WARNING: linker: libsrv_um.so: unused DT entry: type 0xf arg 0xc4e
WARNING: linker: gralloc.jacinto6.so: unused DT entry: type 0xf arg 0x5d9
WARNING: linker: libpvr2d.so: unused DT entry: type 0xf arg 0x778
Test results for InstrumentationTestRunner=
Time: 0.0
OK (0 tests)
我的code的片段是:
My snippet of code is:
public class MyAppTest extends ServiceTestCase<MyApp> {
public MyAppTest(Class serviceClass) {
super(serviceClass);
Log.d(tag, "hello world! MyAppTest ctor");
}
public MyAppTest() {
super(com.abc.def.MyApp.class);
}
...
我按照这个答案 http://stackoverflow.com/a/8981508/398348
我使用不当ServiceTestCase?
Am I using ServiceTestCase incorrectly?
推荐答案
由于Vesko所说,code是正确的;然而,问题的根源是地塞米松preOptimization - 更新到我的code组没有出现在运行时的行为。
As Vesko said, the code is correct; however root cause of the problem was Dex preOptimization - updates to my code were not showing up in the behavior of the runtime.
解决方案?我不得不推的ODEX文件以及该APK的设备。
Solution? I had to push the odex file as well as the apk to the device.
这篇关于如何正确使用android.test.ServiceTestCase?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文