我试图在测试Android项目时运行Emma,该项目是Java和C/JNI代码的组合.构建和测试工作正常,但每当我添加emma,我得到一个神秘的例外.我正在使用Android SDK v20.1和NDK r8b.
该项目在这里,它是一个Android库项目:https: //github.com/guardianproject/IOCipher ,测试在这里:https: //github.com/guardianproject/IOCipherTests
该build.xml文件是使用生成的android update test-project.ant clean debug install test每次运行都会ant clean emma debug install test触发异常:
这是例外:
-dex:
[dex] Converting compiled files and external libraries into /var/lib/jenkins/workspace/IOCipherTests/IOCipherTests/bin/classes.dex...
[dx]
[dx] EXCEPTION FROM SIMULATION:
[dx] local variable type mismatch: attempt to set or access a value of type int using a local variable of type info.guardianproject.libcore.io.ErrnoException. This is symptomatic of .class transformation tools that ignore local variable information.
[dx]
[dx] ...at bytecode offset 0000002e
[dx] locals[0000]: Linfo/guardianproject/iocipher/File;
[dx] locals[0001]: Linfo/guardianproject/iocipher/FileDescriptor;
[dx] locals[0002]: <invalid>
[dx] locals[0003]: <invalid>
[dx] locals[0004]: <invalid>
[dx] locals[0005]: [Z
[dx] stack[top0]: int{0x00000001 / 1}
[dx] ...while working on block 002c
[dx] ...while working on method createNewFile:()Z
[dx] ...while processing createNewFile ()Z
[dx] ...while processing info/guardianproject/iocipher/File.class
[dx]
[dx] 1 error; aborting
BUILD FAILED
/opt/android-sdk/tools/ant/build.xml:850: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:852: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:864: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:266: null returned: 1
Run Code Online (Sandbox Code Playgroud)
小智 3
我遇到了同样的错误。在我的项目中,我们在一个项目中有一个单元测试应用程序,它包装了另一个包含单元测试本身的项目。这两个项目都引用了我的 SDK,正如 chaitanya 所建议的,这导致 emma 两次检测 SDK 代码。通过删除单元测试项目中对 SDK 的引用,我能够解决该错误。