Adding "emma" to Android ant triggers the assembly "local variable type exception" exception

I am trying to run Emma on tests for an Android project, which is a combination of Java code and C / JNI. The build and tests work fine, but whenever I add emma , I get a cryptic exception. I am using Android SDK v20.1 and NDK r8b.

The project is here, its Android library project: https://github.com/guardianproject/IOCipher and tests here: https://github.com/guardianproject/IOCipherTests

The build.xml file is created using android update test-project . Running ant clean debug install test works every time ant clean emma debug install test exception:

here is the exception:

 -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 
+7
source share
2 answers

I was getting the same error. In my project, we had a unit test application in one project, in which another project was completed containing the unit tests themselves. Both projects contained links to my SDK, which, as Chaitanya suggested, forced Emma to enter the SDK code twice. By removing the SDK link in the unit test project, I was able to resolve the error.

+3
source

I am creating an Android APK project from the command line (without ant, but with some help from CMake. I think this is not important here), and I met the same error, two things helped me:

  • From here , I got information that "If you have tool class files that have a local debugging information variable, emma does not correctly maintain the local variable table in them, which will lead to an error when trying to convert class files for Android. Workaround for this is to compile java classes only with information about debugging the string and source, and not local information. ", so I add the flag to the java compiler -g:{lines,source}

  • I also excluded Emma classes from the toolkit. My toolkit team is java -cp emma/emma_device.jar emma instr -ix -*.test.*,-com.google.android.*,-com.vladium.* -m overwrite -cp ${CMAKE_JAVA_TARGET_OUTPUT_DIR} . Note the -ix -com.vladium.* , this excludes Emma classes

0
source

All Articles