Question

I'm setting up automatic testing for Android. If I run

ant instrument install test

and have my physical device hooked up, it works like a charm:

[echo] Running tests ...
 [exec] 
 [exec] com.abc.test.MainActivityUnitTest:.
 [exec] Test results for InstrumentationTestRunner=.
 [exec] Time: 3.362
 [exec] 
 [exec] OK (1 test)
 [exec] 
 [exec] 

If I deploy this on an emulated device, I get the following:

[echo] Running tests ...
 [exec] INSTRUMENTATION_STATUS: id=ActivityManagerService
 [exec] INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{com.abc.test/android.test.InstrumentationTestRunner} from pid=1134, uid=1134 not allowed because package com.abc.test does not have a signature matching the target com.abc
 [exec] INSTRUMENTATION_STATUS_CODE: -1
 [exec] java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.abc.test/android.test.InstrumentationTestRunner} from pid=1134, uid=1134 not allowed because package com.abc.test does not have a signature matching the target com.abc
 [exec]     at android.os.Parcel.readException(Parcel.java:1465)
 [exec]     at android.os.Parcel.readException(Parcel.java:1419)
 [exec]     at android.app.ActivityManagerProxy.startInstrumentation(ActivityManagerNative.java:3188)
 [exec]     at com.android.commands.am.Am.runInstrument(Am.java:864)
 [exec]     at com.android.commands.am.Am.onRun(Am.java:282)
 [exec]     at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
 [exec]     at com.android.commands.am.Am.main(Am.java:76)
 [exec]     at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
 [exec]     at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
 [exec]     at dalvik.system.NativeStart.main(Native Method)

I am using ant to build and Robotium to test. Does anybody have an idea?

EDIT: I read that there could be some kind of problem with the signing of a previously installed version of the app. So I wiped the emulator and deployed again. This time I got:

[echo] Running tests ...
 [exec] 
 [exec] com.abc.MainActivityUnitTest:INSTRUMENTATION_RESULT: shortMsg=Native crash
 [exec] INSTRUMENTATION_RESULT: longMsg=Native crash: Segmentation fault
 [exec] INSTRUMENTATION_CODE: 0

As anthonymasson suggested I checked my device configuration and the SD-Memory was set to 0. Now I got the following:

[echo] Running tests ...
 [exec] 
 [exec] com.abc.test.MainActivityUnitTest:INSTRUMENTATION_RESULT: shortMsg=Process crashed.
 [exec] INSTRUMENTATION_CODE: 0

If I run the test in ADT it is actually green. But in the logcat there is following exception:

java.io.FileNotFoundException: /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq: open failed: ENOENT (No such file or directory)

Any idea what that means? Google isn't very helpful...

Was it helpful?

Solution 3

Almost my complete journey is described in the answer by now.

But the final nail in my coffin is following: The tests are green, because they run before the error occurs. The error is related to my app trying to read hardware information that is not available on the emulator.

Someone suggested to try out Genymotion. I've not yet looked into that, but if someone has the same issue as this, he might have luck with that.

I'll update this as soon as I have more input.

OTHER TIPS

Check your RAM/SD devide. Normaly is the configuration of your VM. Your program try to access to something doesn't exist.

 [exec] INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{com.graphmasters.nunav.test/android.test.InstrumentationTestRunner} from pid=1134, uid=1134 not allowed because package com.graphmasters.nunav.test does not have a signature matching the target com.graphmasters.nunav
 [exec] INSTRUMENTATION_STATUS_CODE: -1
 [exec] java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{com.graphmasters.nunav.test/android.test.InstrumentationTestRunner} from pid=1134, uid=1134 not allowed because package com.graphmasters.nunav.test does not have a signature matching the target com.graphmasters.nunav

check com.abc and com.abc.test both signatures

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top