Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
添加';艾玛';到Android ant构建触发器”;局部变量类型不匹配“;例外_Android_Ant_Emma - Fatal编程技术网

添加';艾玛';到Android ant构建触发器”;局部变量类型不匹配“;例外

添加';艾玛';到Android ant构建触发器”;局部变量类型不匹配“;例外,android,ant,emma,Android,Ant,Emma,我试图在一个Android项目的测试中运行Emma,该项目是Java和C/JNI代码的组合。构建和测试工作得很好,但每当我添加emma时,就会出现一个神秘的异常。我使用的是Android SDK v20.1和NDK r8b 项目就在这里,它是一个Android库项目: 测试如下: build.xml文件是使用android更新测试项目生成的。运行ant clean debug install test每次都有效,而ant clean emma debug install test触发异常: -

我试图在一个Android项目的测试中运行Emma,该项目是Java和C/JNI代码的组合。构建和测试工作得很好,但每当我添加emma时,就会出现一个神秘的异常。我使用的是Android SDK v20.1和NDK r8b

项目就在这里,它是一个Android库项目: 测试如下:

build.xml
文件是使用
android更新测试项目生成的。运行
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
例外情况如下:

-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
-dex:
[dex]将编译文件和外部库转换为/var/lib/jenkins/workspace/IOCipherTests/IOCipherTests/bin/classes.dex。。。
[dx]
[dx]模拟异常:
[dx]局部变量类型不匹配:尝试使用info.guardianproject.libcore.io.ErrnoException类型的局部变量设置或访问int类型的值。这是忽略局部变量信息的.class转换工具的症状。
[dx]
[dx]…字节码偏移量0000002e处
[dx]locals[0000]:Linfo/guardianproject/iocipher/File;
[dx]局部变量[0001]:Linfo/guardianproject/iocipher/FileDescriptor;
[dx]本地人[0002]:
[dx]本地人[0003]:
[dx]本地人[0004]:
[dx]本地人[0005]:[Z
[dx]堆栈[top0]:int{0x00000001/1}
[dx]…在块002c上工作时
[dx]…在处理方法createNewFile:()Z时
[dx]…在处理createNewFile()时
[dx]…在处理info/guardianproject/iocipher/File.class时
[dx]
[dx]1错误;正在中止
构建失败
/opt/android sdk/tools/ant/build.xml:850:执行此行时发生以下错误:
/opt/android sdk/tools/ant/build.xml:852:执行此行时发生以下错误:
/opt/android sdk/tools/ant/build.xml:864:执行此行时发生以下错误:
/opt/android sdk/tools/ant/build.xml:266:null返回:1

我遇到了同样的错误。在我的项目中,我们在一个项目中有一个单元测试应用程序,它包装了另一个包含单元测试本身的项目。两个项目都引用了我的SDK,正如chaitanya所建议的,这导致emma两次插入SDK代码。通过删除单元测试项目中对SDK的引用,我能够解决错误。

我从命令行构建Android APK项目(没有ant,但有CMake的帮助。我想这在这里并不重要),我遇到了同样的错误,有两件事帮助了我:

  • 从,我得到了“如果插入包含局部变量调试信息的类文件,emma不会正确维护局部变量表。这将在您尝试转换Android类文件时导致错误。解决方法是编译仅包含行和源调试信息而非局部信息的java类。,因此我向java编译器
    -g:{lines,source}

  • 我还从插装中排除了Emma类本身。我的插装命令是
    java-cp Emma/Emma\u device.jar Emma instr-ix-*.test.*-com.google.android.*-com.vladium.*-m overwrite-cp${CMAKE\u java\u TARGET\u OUTPUT\u DIR}
    。注意
    -ix-com.vladium.
    参数,这排除了Emma类


  • 添加ant构建文件plz的一些相关部分。ant构建文件是使用
    android update test project
    生成的。我真的不知道要发布哪些部分。FWIW对于没有C或JNI代码的库项目,我有相同的错误。您可能需要在项目的ant.properties中添加emma.filter=-in。我也有同样的问题从中我可以看出,emma试图重新插入已插入指令的代码,这可能会导致问题。刚刚用SDK v21和emma.filter重试,但仍然有相同的错误。对于筛选器,我尝试了
    info.guardianproject.iocipher
    info.guardianproject.iocipher.tests
    是的,这已解决我也是。我的SDK测试在我的主项目下的一个目录中。在我的ant.properties中的测试项目中,我注释掉了这行:#tested.project.dir=/Users/audrey/Developer/MyProject SDK,然后我就不再收到这些错误了。你说的“我的SDK”是什么意思?Android SDK,还是你自己制作的库?