Dalvik - 将java文件添加到项目时局部变量类型不匹配 - 没有proguard [重复]
Posted
技术标签:
【中文标题】Dalvik - 将java文件添加到项目时局部变量类型不匹配 - 没有proguard [重复]【英文标题】:Dalvik - local variable type mismatch when adding java file to project - Without proguard [duplicate] 【发布时间】:2013-03-10 05:53:20 【问题描述】:我的 android 项目编译和构建很好,但是,当我添加 NanoHTTPD java 文件(纯 java 1 文件 http 服务器)时,我在启动时收到以下错误(没有 proguard)。
[2013-03-20 23:28:56 - test] Dx
EXCEPTION FROM SIMULATION:
[2013-03-20 23:28:56 - test] Dx local variable type mismatch: attempt to set or access a value of type int using a local variable of type java.io.ByteArrayInputStream. This is symptomatic of .class transformation tools that ignore local variable information.
[2013-03-20 23:28:56 - test] Dx ...at bytecode offset 0000009d
locals[0000]: Lcom/my/android/test/NanoHTTPD$HTTPSession;
locals[0001]: Ljava/io/InputStream;
locals[0002]: I
locals[0003]: [B
locals[0004]: I
locals[0005]: I
locals[0006]: I
locals[0007]:
locals[0008]:
locals[0009]:
locals[000a]:
locals[000b]:
locals[000c]:
locals[000d]:
locals[000e]:
locals[000f]:
locals[0010]:
locals[0011]:
locals[0012]:
locals[0013]:
locals[0014]:
locals[0015]:
locals[0016]:
locals[0017]:
locals[0018]:
locals[0019]:
locals[001a]:
locals[001b]: [I
...while working on block 009d
...while working on method run:()V
...while processing run ()V
...while processing com/my/android/test/NanoHTTPD$HTTPSession.class
[2013-03-20 23:28:56 - test] Dx
EXCEPTION FROM SIMULATION:
[2013-03-20 23:28:56 - test] Dx local variable type mismatch: attempt to set or access a value of type java.lang.Object using a local variable of type int. This is symptomatic of .class transformation tools that ignore local variable information.
[2013-03-20 23:28:56 - test] Dx ...at bytecode offset 000002cd
locals[0000]: Lcom/my/android/test/NanoHTTPD;
locals[0001]: Ljava/lang/String;
locals[0002]: Ljava/util/Properties;
locals[0003]: Ljava/io/File;
locals[0004]: I
locals[0005]: Lcom/my/android/test/NanoHTTPD$Response;
locals[0006]: Ljava/io/File;
locals[0007]: [Ljava/lang/String;
locals[0008]: Ljava/lang/String;
locals[0009]:
locals[000a]:
locals[000b]:
locals[000c]:
locals[000d]:
locals[000e]:
locals[000f]:
locals[0010]:
locals[0011]:
locals[0012]:
locals[0013]:
locals[0014]:
locals[0015]:
locals[0016]: [I
stack[top0]: Ljava/lang/String;
...while working on block 02cd
...while working on method serveFile:(Ljava/lang/String;Ljava/util/Properties;Ljava/io/File;Z)Lcom/my/android/test/NanoHTTPD$Response;
...while processing serveFile (Ljava/lang/String;Ljava/util/Properties;Ljava/io/File;Z)Lcom/my/android/test/NanoHTTPD$Response;
...while processing com/my/android/test/NanoHTTPD.class
这只发生在当前项目上,当我在其他项目上使用 NanoHTTPD 时没有发生。
我该如何解决这个问题?
【问题讨论】:
【参考方案1】:原来是 Eclipse 插件做到了 - CodePro BY GOOGLE! 他们的代码覆盖工具不知何故导致了上述错误(可能与 emma 有关,但这只是猜测)。
【讨论】:
嗨 inistel,我也有同样的问题。如果您有任何解决方案,请建议我。喜欢如何解决这个问题。以上是关于Dalvik - 将java文件添加到项目时局部变量类型不匹配 - 没有proguard [重复]的主要内容,如果未能解决你的问题,请参考以下文章
转换为 Dalvik 格式失败:无法执行 dex:Java 堆空间